Vector3 WorldPosition { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The WorldPosition property represents the position of the game object in world coordinates. It is a Vector3 value that provides the exact location of the game object within the scene, taking into account the entire hierarchy of transformations from the root of the scene to the object itself.

Usage

Use the WorldPosition property to get or set the position of a game object in the world space. This is useful when you need to position an object relative to the entire scene rather than its parent object.

Example

// Example of accessing and modifying the WorldPosition property

// Assume 'component' is an instance of a Component
Vector3 currentWorldPosition = component.WorldPosition;

// Log the current world position
Log.Info($"Current World Position: {currentWorldPosition}");

// Set a new world position
component.WorldPosition = new Vector3(10.0f, 5.0f, 3.0f);

// Verify the new position
Log.Info($"New World Position: {component.WorldPosition}");