The Scale
property of the BoxCollider
class represents the size of the box collider, measured from corner to corner. This property is of type Vector3
, allowing you to specify the width, height, and depth of the box collider in 3D space.
The Scale
property of the BoxCollider
class represents the size of the box collider, measured from corner to corner. This property is of type Vector3
, allowing you to specify the width, height, and depth of the box collider in 3D space.
To use the Scale
property, you can get or set its value to adjust the size of the box collider. This is useful for defining the physical boundaries of an object in a scene.
// Example of setting the Scale property of a BoxCollider BoxCollider boxCollider = new BoxCollider(); boxCollider.Scale = new Vector3(2.0f, 3.0f, 1.5f); // Sets the size of the box collider // Example of getting the Scale property Vector3 currentScale = boxCollider.Scale; // currentScale now holds the value (2.0, 3.0, 1.5)