Method ComputeWorldTransformMatrix
ComputeWorldTransformMatrix(in Entity, out float4x4, ref ComponentLookup<LocalTransform>, ref ComponentLookup<Parent>, ref ComponentLookup<PostTransformMatrix>)
Synchronously compute a local-to-world transformation matrix for an entity, using the current values of LocalTransform and PostTransformMatrix for the target entity and its hierarchy ancestors.
Declaration
[GenerateTestsForBurstCompatibility]
public static void ComputeWorldTransformMatrix(in Entity entity, out float4x4 outputMatrix, ref ComponentLookup<LocalTransform> localTransformLookup, ref ComponentLookup<Parent> parentLookup, ref ComponentLookup<PostTransformMatrix> scaleLookup)
Parameters
Type | Name | Description |
---|---|---|
Entity | entity | The entity whose world-space transform should be computed. |
float4x4 | outputMatrix | If successful, the output world-space transformation matrix will be stored here. |
Component |
localTransformLookup | Required to access the current transform values for |
Component |
parentLookup | Required to access the current parent for |
Component |
scaleLookup | Required to access the current non-uniform scale values for |
Remarks
This method is intended for the relatively uncommon cases where an entity's accurate world-space transformation matrix is needed immediately. For example:
- When performing a raycast from an entity which may be part of an entity hierarchy, such as the wheel of a
car object. The ray origin must be in world-space, but the entity's Local
Transform may be relative to its parent. - When one entity's transform needs to "track" another in world-space, and the targeting entity and/or the targeted entity are in a transform hierarchy.
- When an entity's transform is modified in the Late
Simulation (after the TransformSystem Group System has updated, but before the PresentationGroup System runs), this method can be used to compute a new LocalGroup To value for the affected entity.World
For an entity that is not part of an entity hierarchy, the Local
The Local
This method's running time scales with the depth of the target entity
is in its hierarchy.
Exceptions
Type | Condition |
---|---|
Invalid |
Thrown if |