Description
The Transform.Concat
method is a static method that combines two transforms, parent
and local
, into a single transform. This operation effectively applies the local transform to the parent transform, resulting in a new transform that represents the combined effect of both.
Usage
To use the Transform.Concat
method, provide two Transform
objects as parameters: parent
and local
. The method will return a new Transform
that is the result of applying the local
transform to the parent
transform.
This method is useful when you need to calculate the world transform of an object that has a local transform relative to a parent object.
Example
// Example of using Transform.Concat
Transform parentTransform = new Transform
{
Position = new Vector3(10, 0, 0),
Rotation = Rotation.FromYaw(45),
Scale = new Vector3(1, 1, 1)
};
Transform localTransform = new Transform
{
Position = new Vector3(5, 0, 0),
Rotation = Rotation.FromYaw(30),
Scale = new Vector3(1, 1, 1)
};
Transform combinedTransform = Transform.Concat(parentTransform, localTransform);
// combinedTransform now represents the world transform of an object
// that is positioned at (5, 0, 0) relative to a parent at (10, 0, 0) with rotations applied.