Table of Contents

Class BodyForces

Namespace
Stride.CommunityToolkit.Box2D
Assembly
Stride.CommunityToolkit.Box2D.dll

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

bodyId B2BodyId

The target body.

impulse Vector2

The 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

bodyId B2BodyId

The target body.

impulse Vector2

The impulse in newton-seconds.

point Vector2

World-space application point.

GetVelocity(B2BodyId)

Gets the body's linear velocity.

public static Vector2 GetVelocity(B2BodyId bodyId)

Parameters

bodyId B2BodyId

The 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

bodyId B2BodyId

The target body.

velocity Vector2

The new velocity.