The WorldPosition
property of a GameObject
represents its position in the world space. This is a Vector3
value that indicates the object's location relative to the world origin, rather than its parent or local space.
The WorldPosition
property of a GameObject
represents its position in the world space. This is a Vector3
value that indicates the object's location relative to the world origin, rather than its parent or local space.
Use the WorldPosition
property to get or set the position of a GameObject
in the world space. This is useful when you need to position an object globally, without considering its parent hierarchy.
// Example of setting a GameObject's world position GameObject myObject = new GameObject(); myObject.WorldPosition = new Vector3(10, 5, 3); // Example of getting a GameObject's world position Vector3 position = myObject.WorldPosition; // Output the world position // Note: Avoid using Console.WriteLine in Sandbox // Instead, use a debug method or log system DebugOverlay.Text(position.ToString(), position);