Class BodyForces
Force, impulse, and velocity helpers applied to bodies by id.
public static class BodyForces
- Inheritance
-
BodyForces
Methods
ApplyImpulse(B2BodyId, Vector2)
Applies a linear impulse to the body's center of mass, waking it.
public static void ApplyImpulse(B2BodyId bodyId, Vector2 impulse)
Parameters
bodyIdB2BodyIdThe target body.
impulseVector2The impulse in newton-seconds.
ApplyImpulseAtPoint(B2BodyId, Vector2, Vector2)
Applies a linear impulse at a world-space point, waking the body.
public static void ApplyImpulseAtPoint(B2BodyId bodyId, Vector2 impulse, Vector2 point)
Parameters
bodyIdB2BodyIdThe target body.
impulseVector2The impulse in newton-seconds.
pointVector2World-space application point.
GetVelocity(B2BodyId)
Gets the body's linear velocity.
public static Vector2 GetVelocity(B2BodyId bodyId)
Parameters
bodyIdB2BodyIdThe target body.
Returns
- Vector2
The current velocity.
SetVelocity(B2BodyId, Vector2)
Sets the body's linear velocity.
public static void SetVelocity(B2BodyId bodyId, Vector2 velocity)
Parameters
bodyIdB2BodyIdThe target body.
velocityVector2The new velocity.