C# Class Box2D.Dynamics.Body

A rigid body. These are created via World.createBody.
Afficher le fichier Open project: gerich-home/box2dnet Class Usage Examples

Méthodes publiques

Свойство Type Description
FixtureCount int
Flags TypeFlags
Force Box2D.Common.Vec2
I float
InvI float
InvMass float
IslandIndex int
Prev Body
SleepTime float
Sweep Box2D.Common.Sweep
Torque float
Xf Box2D.Common.Transform

Méthodes publiques

Méthode Description
ApplyAngularImpulse ( float impulse ) : void

Apply an angular impulse.

ApplyForce ( Vec2 force, Vec2 point ) : void

Apply a force at a world point. If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity. This wakes up the body.

ApplyForceToCenter ( Vec2 force ) : void

Apply a force to the center of mass. This wakes up the body.

ApplyLinearImpulse ( Vec2 impulse, Vec2 point ) : void

Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This wakes up the body.

ApplyTorque ( float torque ) : void

Apply a torque. This affects the angular velocity without affecting the linear velocity of the center of mass. This wakes up the body.

Body ( BodyDef bd, World world ) : System
CreateFixture ( FixtureDef def ) : Fixture

Creates a fixture and attach it to this body. Use this function if you need to set some fixture parameters, like friction. Otherwise you can create the fixture directly from a shape. If the density is non-zero, this function automatically updates the mass of the body. Contacts are not created until the next time step.

CreateFixture ( Shape shape, float density ) : Fixture

Creates a fixture from a shape and attach it to this body. This is a convenience function. Use FixtureDef if you need to set parameters like friction, restitution, user data, or filtering. If the density is non-zero, this function automatically updates the mass of the body.

DestroyFixture ( Fixture fixture ) : void

Destroy a fixture. This removes the fixture from the broad-phase and destroys all contacts associated with this fixture. This will automatically adjust the mass of the body if the body is dynamic and the fixture has positive density. All fixtures attached to a body are implicitly destroyed when the body is destroyed.

GetLinearVelocityFromLocalPoint ( Vec2 localPoint ) : Vec2

Get the world velocity of a local point.

GetLinearVelocityFromLocalPointToOut ( Vec2 localPoint, Vec2 result ) : void
GetLinearVelocityFromWorldPoint ( Vec2 worldPoint ) : Vec2

Get the world linear velocity of a world point attached to this body.

GetLinearVelocityFromWorldPointToOut ( Vec2 worldPoint, Vec2 result ) : void
GetLocalPoint ( Vec2 worldPoint ) : Vec2

Gets a local point relative to the body's origin given a world point.

GetLocalPointToOut ( Vec2 worldPoint, Vec2 result ) : void
GetLocalVector ( Vec2 worldVector ) : Vec2

Gets a local vector given a world vector.

GetLocalVectorToOut ( Vec2 worldVector, Vec2 result ) : void
GetLocalVectorToOutUnsafe ( Vec2 worldVector, Vec2 result ) : void
GetMassData ( MassData data ) : void

Get the mass data of the body. The rotational inertia is relative to the center of mass.

GetTransform ( ) : Transform

Get the body transform for the body's origin.

GetWorldPoint ( Vec2 localPoint ) : Vec2

Get the world coordinates of a point given the local coordinates.

GetWorldPointToOut ( Vec2 localPoint, Vec2 result ) : void
GetWorldVector ( Vec2 localVector ) : Vec2

Get the world coordinates of a vector given the local coordinates.

GetWorldVectorToOut ( Vec2 localVector, Vec2 result ) : void
GetWorldVectorToOutUnsafe ( Vec2 localVector, Vec2 result ) : void
ResetMassData ( ) : void

This resets the mass properties to the sum of the mass properties of the fixtures. This normally does not need to be called unless you called setMassData to override the mass and you later want to reset the mass.

SetMassData ( MassData massData ) : void

Set the mass properties to override the mass properties of the fixtures. Note that this changes the center of mass position. Note that creating or destroying fixtures can also alter the mass. This function has no effect if the body isn't dynamic.

SetTransform ( Vec2 position, float angle ) : void

Set the position of the body's origin and rotation. This breaks any contacts and wakes the other bodies. Manipulating a body's transform may cause non-physical behavior.

ShouldCollide ( Body other ) : bool

This is used to prevent connected bodies from colliding. It may lie, depending on the collideConnected flag.

SynchronizeTransform ( ) : void

Private Methods

Méthode Description
Advance ( float t ) : void
SynchronizeFixtures ( ) : void

Method Details

ApplyAngularImpulse() public méthode

Apply an angular impulse.
public ApplyAngularImpulse ( float impulse ) : void
impulse float the angular impulse in units of kg*m*m/s
Résultat void

ApplyForce() public méthode

Apply a force at a world point. If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity. This wakes up the body.
public ApplyForce ( Vec2 force, Vec2 point ) : void
force Box2D.Common.Vec2 the world force vector, usually in Newtons (N).
point Box2D.Common.Vec2 the world position of the point of application.
Résultat void

ApplyForceToCenter() public méthode

Apply a force to the center of mass. This wakes up the body.
public ApplyForceToCenter ( Vec2 force ) : void
force Box2D.Common.Vec2 the world force vector, usually in Newtons (N).
Résultat void

ApplyLinearImpulse() public méthode

Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This wakes up the body.
public ApplyLinearImpulse ( Vec2 impulse, Vec2 point ) : void
impulse Box2D.Common.Vec2 the world impulse vector, usually in N-seconds or kg-m/s.
point Box2D.Common.Vec2 the world position of the point of application.
Résultat void

ApplyTorque() public méthode

Apply a torque. This affects the angular velocity without affecting the linear velocity of the center of mass. This wakes up the body.
public ApplyTorque ( float torque ) : void
torque float about the z-axis (out of the screen), usually in N-m.
Résultat void

Body() public méthode

public Body ( BodyDef bd, World world ) : System
bd BodyDef
world World
Résultat System

CreateFixture() public méthode

Creates a fixture and attach it to this body. Use this function if you need to set some fixture parameters, like friction. Otherwise you can create the fixture directly from a shape. If the density is non-zero, this function automatically updates the mass of the body. Contacts are not created until the next time step.
public CreateFixture ( FixtureDef def ) : Fixture
def FixtureDef the fixture definition.
Résultat Fixture

CreateFixture() public méthode

Creates a fixture from a shape and attach it to this body. This is a convenience function. Use FixtureDef if you need to set parameters like friction, restitution, user data, or filtering. If the density is non-zero, this function automatically updates the mass of the body.
public CreateFixture ( Shape shape, float density ) : Fixture
shape Box2D.Collision.Shapes.Shape the shape to be cloned.
density float the shape density (set to zero for static bodies).
Résultat Fixture

DestroyFixture() public méthode

Destroy a fixture. This removes the fixture from the broad-phase and destroys all contacts associated with this fixture. This will automatically adjust the mass of the body if the body is dynamic and the fixture has positive density. All fixtures attached to a body are implicitly destroyed when the body is destroyed.
public DestroyFixture ( Fixture fixture ) : void
fixture Fixture the fixture to be removed.
Résultat void

GetLinearVelocityFromLocalPoint() public méthode

Get the world velocity of a local point.
public GetLinearVelocityFromLocalPoint ( Vec2 localPoint ) : Vec2
localPoint Box2D.Common.Vec2 point in local coordinates.
Résultat Box2D.Common.Vec2

GetLinearVelocityFromLocalPointToOut() public méthode

public GetLinearVelocityFromLocalPointToOut ( Vec2 localPoint, Vec2 result ) : void
localPoint Box2D.Common.Vec2
result Box2D.Common.Vec2
Résultat void

GetLinearVelocityFromWorldPoint() public méthode

Get the world linear velocity of a world point attached to this body.
public GetLinearVelocityFromWorldPoint ( Vec2 worldPoint ) : Vec2
worldPoint Box2D.Common.Vec2 point in world coordinates.
Résultat Box2D.Common.Vec2

GetLinearVelocityFromWorldPointToOut() public méthode

public GetLinearVelocityFromWorldPointToOut ( Vec2 worldPoint, Vec2 result ) : void
worldPoint Box2D.Common.Vec2
result Box2D.Common.Vec2
Résultat void

GetLocalPoint() public méthode

Gets a local point relative to the body's origin given a world point.
public GetLocalPoint ( Vec2 worldPoint ) : Vec2
worldPoint Box2D.Common.Vec2 point in world coordinates.
Résultat Box2D.Common.Vec2

GetLocalPointToOut() public méthode

public GetLocalPointToOut ( Vec2 worldPoint, Vec2 result ) : void
worldPoint Box2D.Common.Vec2
result Box2D.Common.Vec2
Résultat void

GetLocalVector() public méthode

Gets a local vector given a world vector.
public GetLocalVector ( Vec2 worldVector ) : Vec2
worldVector Box2D.Common.Vec2 vector in world coordinates.
Résultat Box2D.Common.Vec2

GetLocalVectorToOut() public méthode

public GetLocalVectorToOut ( Vec2 worldVector, Vec2 result ) : void
worldVector Box2D.Common.Vec2
result Box2D.Common.Vec2
Résultat void

GetLocalVectorToOutUnsafe() public méthode

public GetLocalVectorToOutUnsafe ( Vec2 worldVector, Vec2 result ) : void
worldVector Box2D.Common.Vec2
result Box2D.Common.Vec2
Résultat void

GetMassData() public méthode

Get the mass data of the body. The rotational inertia is relative to the center of mass.
public GetMassData ( MassData data ) : void
data Box2D.Collision.Shapes.MassData
Résultat void

GetTransform() public méthode

Get the body transform for the body's origin.
public GetTransform ( ) : Transform
Résultat Box2D.Common.Transform

GetWorldPoint() public méthode

Get the world coordinates of a point given the local coordinates.
public GetWorldPoint ( Vec2 localPoint ) : Vec2
localPoint Box2D.Common.Vec2 a point on the body measured relative the the body's origin.
Résultat Box2D.Common.Vec2

GetWorldPointToOut() public méthode

public GetWorldPointToOut ( Vec2 localPoint, Vec2 result ) : void
localPoint Box2D.Common.Vec2
result Box2D.Common.Vec2
Résultat void

GetWorldVector() public méthode

Get the world coordinates of a vector given the local coordinates.
public GetWorldVector ( Vec2 localVector ) : Vec2
localVector Box2D.Common.Vec2 a vector fixed in the body.
Résultat Box2D.Common.Vec2

GetWorldVectorToOut() public méthode

public GetWorldVectorToOut ( Vec2 localVector, Vec2 result ) : void
localVector Box2D.Common.Vec2
result Box2D.Common.Vec2
Résultat void

GetWorldVectorToOutUnsafe() public méthode

public GetWorldVectorToOutUnsafe ( Vec2 localVector, Vec2 result ) : void
localVector Box2D.Common.Vec2
result Box2D.Common.Vec2
Résultat void

ResetMassData() public méthode

This resets the mass properties to the sum of the mass properties of the fixtures. This normally does not need to be called unless you called setMassData to override the mass and you later want to reset the mass.
public ResetMassData ( ) : void
Résultat void

SetMassData() public méthode

Set the mass properties to override the mass properties of the fixtures. Note that this changes the center of mass position. Note that creating or destroying fixtures can also alter the mass. This function has no effect if the body isn't dynamic.
public SetMassData ( MassData massData ) : void
massData Box2D.Collision.Shapes.MassData the mass properties.
Résultat void

SetTransform() public méthode

Set the position of the body's origin and rotation. This breaks any contacts and wakes the other bodies. Manipulating a body's transform may cause non-physical behavior.
public SetTransform ( Vec2 position, float angle ) : void
position Box2D.Common.Vec2 the world position of the body's local origin.
angle float the world rotation in radians.
Résultat void

ShouldCollide() public méthode

This is used to prevent connected bodies from colliding. It may lie, depending on the collideConnected flag.
public ShouldCollide ( Body other ) : bool
other Body
Résultat bool

SynchronizeTransform() public méthode

public SynchronizeTransform ( ) : void
Résultat void

Property Details

FixtureCount public_oe property

public int FixtureCount
Résultat int

Flags public_oe property

public TypeFlags Flags
Résultat TypeFlags

Force public_oe property

public Vec2,Box2D.Common Force
Résultat Box2D.Common.Vec2

I public_oe property

public float I
Résultat float

InvI public_oe property

public float InvI
Résultat float

InvMass public_oe property

public float InvMass
Résultat float

IslandIndex public_oe property

public int IslandIndex
Résultat int

Prev public_oe property

public Body,Box2D.Dynamics Prev
Résultat Body

SleepTime public_oe property

public float SleepTime
Résultat float

Sweep public_oe property

The swept motion for CCD
public Sweep,Box2D.Common Sweep
Résultat Box2D.Common.Sweep

Torque public_oe property

public float Torque
Résultat float

Xf public_oe property

The body origin transform.
public Transform,Box2D.Common Xf
Résultat Box2D.Common.Transform