The Transform3D is an entity component providing position and rotation for a 3D object.
More...
|
override int | GetHashCode () |
| Overrides the hash code generation of this type. More...
|
|
FPVector3 | InverseTransformDirection (FPVector3 direction) |
| Transforms a direction from world space to local space. Rotation is expected to be normalized. More...
|
|
FPVector3 | InverseTransformPoint (FPVector3 position) |
| Transforms a position from world space to local space. Rotation is expected to be normalized. More...
|
|
void | LookAt (FPVector3 position, FPVector3? up=null) |
| Rotates the transform so the forward vector points at position . If up is not set, will use FPVector3.Up instead. More...
|
|
void | Rotate (FP xAngle, FP yAngle, FP zAngle, bool normalize=true) |
| Applies a rotation of zAngle degrees around the z-axis, xAngle degrees around the x-axis, and yAngle degrees around the y-axis (in that order). More...
|
|
void | Rotate (FPVector3 angles, bool normalize=true) |
| Applies a rotation of angles .z degrees around the z-axis, angles .x degrees around the x-axis, and angles .y degrees around the y-axis (in that order). More...
|
|
void | Rotate (FPVector3 axis, FP angle, bool normalize=true) |
| Rotates the object around the given axis by the number of degrees defined by the given angle. More...
|
|
void | RotateAround (FPVector3 point, FPVector3 axis, FP angle, bool rotateTransform=true) |
| Rotates around a given pivot point. More...
|
|
void | Teleport (FrameBase frame, FPQuaternion rotation) |
|
void | Teleport (FrameBase frame, FPVector3 position) |
|
void | Teleport (FrameBase frame, FPVector3 position, FPQuaternion rotation) |
|
void | Teleport (FrameBase frame, Transform3D *transform) |
|
FPVector3 | TransformDirection (FPVector3 direction) |
| Transforms a direction from local space to world space. Rotation is expected to be normalized. More...
|
|
FPVector3 | TransformPoint (FPVector3 position) |
| Transforms a position from local space to world space. Rotation is expected to be normalized. More...
|
|
|
const int | SIZE = 8 + FPVector3.SIZE + FPQuaternion.SIZE |
| The size of the component (or struct/type) in-memory inside the Frame data-buffers or stack (when passed as value parameter). Not related to the snapshot payload this occupies, which is bit-packed and compressed. More...
|
|
The Transform3D is an entity component providing position and rotation for a 3D object.
Always use the factory create method Create(FPVector3) or Create(FPVector3, FPQuaternion) or correctly initialize the rotation Quaternion manually.
◆ Create() [1/2]
Factory create a Transform3D component.
Sets the Rotation to FPQuaternion.Identity.
- Parameters
-
position | The initial world position. |
- Returns
- New initialized Transform3D component.
◆ Create() [2/2]
Factory create a Transform3D component.
- Parameters
-
position | The initial world position. |
rotation | The initial rotation. |
- Returns
- New initialized Transform3D component.
◆ RotateAround()
void Quantum.Transform3D.RotateAround |
( |
FPVector3 |
point, |
|
|
FPVector3 |
axis, |
|
|
FP |
angle, |
|
|
bool |
rotateTransform = true |
|
) |
| |
|
inline |
Rotates around a given pivot point.
The method works as expected but does generate slightly different results than Unity's Transform.RotateAround(). The algorithm may be subject to change in future versions.
- Parameters
-
point | The pivot point. |
axis | What axis to rotate. |
angle | The angle. |
rotateTransform | |
◆ Serialize()
static void Quantum.Transform3D.Serialize |
( |
void * |
ptr, |
|
|
FrameSerializer |
serializer |
|
) |
| |
|
inlinestatic |
Serializes a Transform3D into a FrameSerializer.
- Parameters
-
ptr | The pointer to the Transform3D. |
serializer | The FrameSerializer instance into which the struct will be serialized. |
◆ GetHashCode()
override int Quantum.Transform3D.GetHashCode |
( |
| ) |
|
|
inline |
Overrides the hash code generation of this type.
- Returns
- A hash code of the current state of this instance.
◆ InverseTransformDirection()
Transforms a direction from world space to local space. Rotation is expected to be normalized.
◆ TransformDirection()
Transforms a direction from local space to world space. Rotation is expected to be normalized.
◆ InverseTransformPoint()
Transforms a position from world space to local space. Rotation is expected to be normalized.
◆ TransformPoint()
Transforms a position from local space to world space. Rotation is expected to be normalized.
◆ LookAt()
Rotates the transform so the forward vector points at position . If up is not set, will use FPVector3.Up instead.
- Parameters
-
◆ Rotate() [1/3]
void Quantum.Transform3D.Rotate |
( |
FPVector3 |
angles, |
|
|
bool |
normalize = true |
|
) |
| |
|
inline |
Applies a rotation of angles .z degrees around the z-axis, angles .x degrees around the x-axis, and angles .y degrees around the y-axis (in that order).
- Parameters
-
angles | Euler angles, in degrees. |
normalize | If the resultant quaternion should be normalized before being set to the Rotation. This prevents rounding error from accumulating and potentially rounding the quaternion magnitude towards zero over time. |
◆ Rotate() [2/3]
void Quantum.Transform3D.Rotate |
( |
FP |
xAngle, |
|
|
FP |
yAngle, |
|
|
FP |
zAngle, |
|
|
bool |
normalize = true |
|
) |
| |
|
inline |
Applies a rotation of zAngle degrees around the z-axis, xAngle degrees around the x-axis, and yAngle degrees around the y-axis (in that order).
- Parameters
-
xAngle | |
yAngle | |
zAngle | |
normalize | If the resultant quaternion should be normalized before being set to the Rotation. This prevents rounding error from accumulating and potentially rounding the quaternion magnitude towards zero over time. |
◆ Rotate() [3/3]
void Quantum.Transform3D.Rotate |
( |
FPVector3 |
axis, |
|
|
FP |
angle, |
|
|
bool |
normalize = true |
|
) |
| |
|
inline |
Rotates the object around the given axis by the number of degrees defined by the given angle.
- Parameters
-
axis | |
angle | |
normalize | If the resultant quaternion should be normalized before being set to the Rotation. This prevents rounding error from accumulating and potentially rounding the quaternion magnitude towards zero over time. |
◆ SIZE
const int Quantum.Transform3D.SIZE = 8 + FPVector3.SIZE + FPQuaternion.SIZE |
|
static |
The size of the component (or struct/type) in-memory inside the Frame data-buffers or stack (when passed as value parameter). Not related to the snapshot payload this occupies, which is bit-packed and compressed.
◆ Position
The world position of the entity.
◆ Rotation
The rotation of the entity.
◆ PositionTeleportFrame
Int32 Quantum.Transform3D.PositionTeleportFrame => _positionTeleportFrame |
Last frame when a position teleport was called. Used by view to ignore interpolation.
◆ RotationTeleportFrame
Int32 Quantum.Transform3D.RotationTeleportFrame => _rotationTeleportFrame |
Last frame when a rotation teleport was called. Used by view to ignore interpolation.
◆ Left
A vector pointing to local -X axis.
◆ Down
A vector pointing to local -Y axis.
◆ Back
A vector pointing to local -Z axis.
◆ EulerAngles
FPVector3 Quantum.Transform3D.EulerAngles => Rotation.AsEuler |
Converts rotation to Euler angles triplet.
- See also
- FPQuaternion.AsEuler
.
◆ LocalToWorldMatrix
Creates local to world transformation. Rotation is expected to be normalized.
◆ WorldToLocalMatrix
Creates world to local transformation. Rotation is expected to be normalized.
◆ Right
A vector pointing to local +X axis.
◆ Up
A vector pointing to local +Y axis.
◆ Forward
A vector pointing to local +Z axis.