The WorldTransform
property of a GameObject
provides the transform of the object in world space. This includes its position, rotation, and scale relative to the world, rather than its parent object.
The WorldTransform
property of a GameObject
provides the transform of the object in world space. This includes its position, rotation, and scale relative to the world, rather than its parent object.
Use the WorldTransform
property to get or set the global transform of a GameObject
. This is useful when you need to position or orient the object in the world independently of its parent.
// Example of accessing the WorldTransform property GameObject myObject = new GameObject(); Transform worldTransform = myObject.WorldTransform; // Modify the world transform worldTransform.Position = new Vector3(10, 0, 5); worldTransform.Rotation = Rotation.From(0, 90, 0); // Apply the modified transform back to the GameObject myObject.WorldTransform = worldTransform;