Description
The Body
property of the Hitbox
class provides access to the associated PhysicsBody
instance. This property is used to interact with the physical representation of the hitbox within the physics simulation. It allows you to manipulate and query the physical properties and behaviors of the hitbox, such as its position, velocity, and collision responses.
Usage
To use the Body
property, you first need to have an instance of the Hitbox
class. Once you have the instance, you can access the Body
property to perform operations on the PhysicsBody
. This can include setting its position, applying forces, or checking for collisions.
Example usage:
Hitbox hitbox = new Hitbox();
PhysicsBody physicsBody = hitbox.Body;
// Set the position of the physics body
physicsBody.Position = new Vector3(0, 0, 0);
// Apply a force to the physics body
physicsBody.ApplyForce(new Vector3(10, 0, 0));
// Check if the physics body is colliding with another object
bool isColliding = physicsBody.IsColliding;
Example
Hitbox hitbox = new Hitbox();
PhysicsBody physicsBody = hitbox.Body;
// Set the position of the physics body
physicsBody.Position = new Vector3(0, 0, 0);
// Apply a force to the physics body
physicsBody.ApplyForce(new Vector3(10, 0, 0));
// Check if the physics body is colliding with another object
bool isColliding = physicsBody.IsColliding;