The Transform3D is an entity component providing position and rotation for a 3D object. More...
Public Member Functions | |
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... | |
Static Public Member Functions | |
static Transform3D | Create (FPVector3 position, FPQuaternion rotation) |
Factory create a Transform3D component. More... | |
static Transform3D | Create (FPVector3 position=default) |
Factory create a Transform3D component. More... | |
static void | Serialize (void *ptr, FrameSerializer serializer) |
Serializes a Transform3D into a FrameSerializer. More... | |
Public Attributes | |
FPVector3 | Back => -Forward |
A vector pointing to local -Z axis. More... | |
FPVector3 | Down => -Up |
A vector pointing to local -Y axis. More... | |
FPVector3 | EulerAngles => Rotation.AsEuler |
Converts rotation to Euler angles triplet. More... | |
FPVector3 | Left => -Right |
A vector pointing to local -X axis. More... | |
FPMatrix4x4 | LocalToWorldMatrix => FPMatrix4x4.TRS(Position, Rotation, FPVector3.One) |
Creates local to world transformation. Rotation is expected to be normalized. More... | |
FPVector3 | Position |
The world position of the entity. More... | |
Int32 | PositionTeleportFrame => _positionTeleportFrame |
Last frame when a position teleport was called. Used by view to ignore interpolation. More... | |
FPQuaternion | Rotation |
The rotation of the entity. More... | |
Int32 | RotationTeleportFrame => _rotationTeleportFrame |
Last frame when a rotation teleport was called. Used by view to ignore interpolation. More... | |
FPMatrix4x4 | WorldToLocalMatrix => FPMatrix4x4.InverseTRS(Position, Rotation, FPVector3.One) |
Creates world to local transformation. Rotation is expected to be normalized. More... | |
Static Public Attributes | |
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... | |
Properties | |
FPVector3 | Forward [get] |
A vector pointing to local +Z axis. More... | |
FPVector3 | Right [get] |
A vector pointing to local +X axis. More... | |
FPVector3 | Up [get] |
A vector pointing to local +Y axis. 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.
|
inlinestatic |
Factory create a Transform3D component.
Sets the Rotation to FPQuaternion.Identity.
position | The initial world position. |
|
inlinestatic |
Factory create a Transform3D component.
position | The initial world position. |
rotation | The initial rotation. |
|
inline |
Rotates around a given pivot point.
point | The pivot point. |
axis | What axis to rotate. |
angle | The angle. |
rotateTransform |
|
inlinestatic |
Serializes a Transform3D into a FrameSerializer.
ptr | The pointer to the Transform3D. |
serializer | The FrameSerializer instance into which the struct will be serialized. |
|
inline |
Overrides the hash code generation of this type.
Transforms a direction from world space to local space. Rotation is expected to be normalized.
Transforms a direction from local space to world space. Rotation is expected to be normalized.
Transforms a position from world space to local space. Rotation is expected to be normalized.
Transforms a position from local space to world space. Rotation is expected to be normalized.
Rotates the transform so the forward vector points at position . If up is not set, will use FPVector3.Up instead.
position | |
up |
|
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).
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. |
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).
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. |
Rotates the object around the given axis by the number of degrees defined by the given angle.
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. |
|
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.
FPVector3 Quantum.Transform3D.Position |
The world position of the entity.
FPQuaternion Quantum.Transform3D.Rotation |
The rotation of the entity.
Int32 Quantum.Transform3D.PositionTeleportFrame => _positionTeleportFrame |
Last frame when a position teleport was called. Used by view to ignore interpolation.
Int32 Quantum.Transform3D.RotationTeleportFrame => _rotationTeleportFrame |
Last frame when a rotation teleport was called. Used by view to ignore interpolation.
FPVector3 Quantum.Transform3D.EulerAngles => Rotation.AsEuler |
Converts rotation to Euler angles triplet.
.
FPMatrix4x4 Quantum.Transform3D.LocalToWorldMatrix => FPMatrix4x4.TRS(Position, Rotation, FPVector3.One) |
Creates local to world transformation. Rotation is expected to be normalized.
FPMatrix4x4 Quantum.Transform3D.WorldToLocalMatrix => FPMatrix4x4.InverseTRS(Position, Rotation, FPVector3.One) |
Creates world to local transformation. Rotation is expected to be normalized.
|
get |
A vector pointing to local +X axis.
|
get |
A vector pointing to local +Y axis.
|
get |
A vector pointing to local +Z axis.