Description
The WorldScale
property represents the scale of the game object in world coordinates. This property is part of the Component
class and provides a way to access or modify the scale of the game object as it appears in the world, independent of its parent objects.
Usage
Use the WorldScale
property to get or set the scale of a game object in the world. This is useful when you need to adjust the size of an object relative to the world, rather than its local or parent space.
Example
// Example of setting the WorldScale of a component
Component myComponent = new Component();
myComponent.WorldScale = new Vector3(2.0f, 2.0f, 2.0f);
// Example of getting the WorldScale of a component
Vector3 currentScale = myComponent.WorldScale;
// Output the current world scale
// Note: Avoid using Console.WriteLine in Sandbox
// Instead, use a debug overlay or other in-game logging methods
DebugOverlay.Text(currentScale.ToString(), myComponent.WorldPosition);