The WorldPosition
property of a GameObject
represents its position in the world space. This is a Vector3
value that indicates the object's position 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 position 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 independently of its parent or when you want to know its absolute position in the scene.
// Example of setting a GameObject's world position GameObject myObject = new GameObject(); myObject.WorldPosition = new Vector3(10.0f, 5.0f, 3.0f); // Example of getting a GameObject's world position Vector3 position = myObject.WorldPosition; // Output the position // Note: Avoid using Console.WriteLine in Sandbox environment // Instead, use a debug tool or log system provided by the framework