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 world space transform of a GameObject
. This is useful when you need to manipulate or query the object's position, rotation, or scale in the context of the entire scene, rather than relative to its parent.
// Example of accessing the WorldTransform property GameObject myObject = new GameObject(); Transform worldTransform = myObject.WorldTransform; // Example of setting the WorldTransform property Transform newTransform = new Transform(); newTransform.Position = new Vector3(10, 0, 5); newTransform.Rotation = Rotation.From(0, 90, 0); newTransform.Scale = new Vector3(1, 1, 1); myObject.WorldTransform = newTransform;