Castle Game EngineIntroduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers
|
Class T3DTransform
Unit
Castle3D
Declaration
type T3DTransform = class(T3DCustomTransform)
Description
Transform (move, rotate, scale) children T3D objects. Transformation is a combined 1. Translation, 2. and Rotation around Center point, 3. and Scale around Center and with orientation given by ScaleOrientation.
For precise order of the translation/rotation/scale operations, see the X3D Transform node specification.
Default values of all fields indicate "no transformation". So everything is zero, except Scale is (1,1,1).
This descends from T3DList, and it transforms all it's children.
Hierarchy
Overview
Methods
Properties
Description
Methods
 |
function OnlyTranslation: boolean; override; |
|
|
 |
constructor Create(AOwner: TComponent); override; |
|
|
Properties
 |
property Rotation: TVector4Single read FRotation write SetRotation; |
|
Rotation in 3D, around a specified axis. Rotation is expressed as a 4D vector, in which the first 3 components specify the rotation axis (does not need to be normalized, but must be non-zero), and the last component is the rotation angle in radians.
Rotation is done around Center.
|
 |
property Scale: TVector3Single read FScale write SetScale; |
|
Scale in 3D. Scaling is done around Center and with orientation given by ScaleOrientation.
We do the best we can to work with any scale value, even negative or zero. But usually, it's best to keep the scale positive. More information:
If you can, keep the scale uniform, that is scale equal amount in X, Y and Z. For example set scale = (3.0, 3.0, 3.0) to scale 3x times, and avoid scale like (3.0, 1.0, 1.0) that scales more in one direction.
Non-uniform scale works, but some collisions are not perfectly calculated then. (For example, an ideal sphere is no longer a sphere when scaled in non-uniform fashion, and not everywhere do we account for that.) Although it works Ok on meshes. ScaleOrientation matters in case of non-uniform scale.
All scale components should > 0 if you want 3D lighting to work corrrectly. That is, avoid negative scale, that flips the orientation of faces (CCW becomes CW), or standard lighting may not work Ok.
For unlit stuff, or custom lighting, negative scale may be Ok. For many 2D games that use no lighting/custom lighting, negative scale is Ok.
At least, keep all scale components non-zero. Otherwise the scaling operation is not invertible, and generally collisions will not work correctly.
If you really need to set zero scale, at least consider using Collides = False.
|
Generated by PasDoc 0.14.0.
|