Description
The Body
property of the PhysicsWorld
class provides access to the primary PhysicsBody
associated with this physics world. This body represents the main physical entity within the world, allowing for interactions and manipulations of physical properties and behaviors.
Usage
To access the Body
property, you need an instance of the PhysicsWorld
class. Once you have the instance, you can retrieve the PhysicsBody
by simply accessing the Body
property. This can be useful for directly manipulating the main physical body of the world, such as applying forces or setting physical properties.
Example
// Assuming you have a PhysicsWorld instance
PhysicsWorld physicsWorld = new PhysicsWorld();
// Access the main PhysicsBody of the world
PhysicsBody mainBody = physicsWorld.Body;
// Example: Apply a force to the main body
Vector3 force = new Vector3(0, 0, 10);
mainBody.ApplyForce(force);