C# Class Box2DX.Dynamics.Body

Inheritance: IDisposable
Afficher le fichier Open project: KrugerHeavyIndustries/box2d-unity Class Usage Examples

Méthodes publiques

Свойство Type Description
bodyID int

Méthodes publiques

Méthode Description
AllowSleeping ( bool flag ) : void

You can disable sleeping on this body.

ApplyForce ( System.Vector2 force, System.Vector2 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.

ApplyImpulse ( System.Vector2 impulse, System.Vector2 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.

CreateFixture ( FixtureDef def ) : Fixture

Creates a fixture and attach it to this body. @warning This function is locked during callbacks.

DestroyFixture ( Fixture fixture ) : void

Destroy a fixture. This removes the fixture from the broad-phase and therefore destroys any contacts associated with this fixture. All fixtures attached to a body are implicitly destroyed when the body is destroyed. @warning This function is locked during callbacks.

Dispose ( ) : void
GetAngle ( ) : float

Get the angle in radians.

GetAngularDamping ( ) : float
GetAngularVelocity ( ) : float

Get the angular velocity.

GetControllerList ( ) : ControllerEdge
GetFixtureList ( ) : Fixture

Get the list of all fixtures attached to this body.

GetInertia ( ) : float

Get the central rotational inertia of the body.

GetJointList ( ) : JointEdge

Get the list of all joints attached to this body.

GetLinearDamping ( ) : float
GetLinearVelocity ( ) : System.Vector2

Get the linear velocity of the center of mass.

GetLinearVelocityFromLocalPoint ( System.Vector2 localPoint ) : System.Vector2

Get the world velocity of a local point.

GetLinearVelocityFromWorldPoint ( System.Vector2 worldPoint ) : System.Vector2

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

GetLocalCenter ( ) : System.Vector2

Get the local position of the center of mass.

GetLocalPoint ( System.Vector2 worldPoint ) : System.Vector2

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

GetLocalVector ( System.Vector2 worldVector ) : System.Vector2

Gets a local vector given a world vector.

GetMass ( ) : float

Get the total mass of the body.

GetMassData ( ) : MassData

Get the mass data of the body.

GetNext ( ) : Body

Get the next body in the world's body list.

GetPosition ( ) : System.Vector2

Get the world body origin position.

GetTransform ( ) : Box2DX.Common.Transform

Get the body Transform for the body's origin.

GetUserData ( ) : object

Get the user data pointer that was provided in the body definition.

GetWorld ( ) : World

Get the parent world of this body.

GetWorldCenter ( ) : System.Vector2

Get the world position of the center of mass.

GetWorldPoint ( System.Vector2 localPoint ) : System.Vector2

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

GetWorldVector ( System.Vector2 localVector ) : System.Vector2

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

IsAllowSleeping ( ) : bool
IsBullet ( ) : bool

Is this body treated like a bullet for continuous collision detection?

IsDynamic ( ) : bool

Is this body dynamic (movable)?

IsFixedRotation ( ) : bool
IsFrozen ( ) : bool

Is this body frozen?

IsSleeping ( ) : bool

Is this body sleeping (not simulating).

IsStatic ( ) : bool

Is this body static (immovable)?

PutToSleep ( ) : void

Put this body to sleep so it will stop simulating. This also sets the velocity to zero.

SetAngle ( float angle ) : void

Set the world body angle.

SetAngularDamping ( float angularDamping ) : void
SetAngularVelocity ( float w ) : void

Set the angular velocity.

SetBullet ( bool flag ) : void

Should this body be treated like a bullet for continuous collision detection?

SetFixedRotation ( bool fixedr ) : void
SetLinearDamping ( float linearDamping ) : void
SetLinearVelocity ( System.Vector2 v ) : void

Set the linear velocity of the center of mass.

SetMass ( MassData massData ) : void

Set the mass properties. Note that this changes the center of mass position. If you are not sure how to compute mass properties, use SetMassFromShapes. The inertia tensor is assumed to be relative to the center of mass.

SetMassFromShapes ( ) : void

Compute the mass properties from the attached shapes. You typically call this after adding all the shapes. If you add or remove shapes later, you may want to call this again. Note that this changes the center of mass position.

SetPosition ( System.Vector2 position ) : void

Set the world body origin position.

SetStatic ( ) : void
SetTransform ( Box2DX.Common.Transform xf ) : bool

Set the position of the body's origin and rotation (radians). This breaks any contacts and wakes the other bodies. Note this is less efficient than the other overload - you should use that if the angle is available.

SetTransform ( System.Vector2 position, Mat22 rotation ) : bool

Set the position of the body's origin and rotation (radians). This breaks any contacts and wakes the other bodies.

SetTransform ( System.Vector2 position, Quaternion rotation ) : bool
SetTransform ( System.Vector2 position, float angle ) : bool
SetUserData ( object data ) : void

Set the user data. Use this to store your application specific data.

WakeUp ( ) : void

Wake up this body so it will begin simulating.

Private Methods

Méthode Description
Advance ( float t ) : void
Body ( BodyDef bd, World world ) : System
IsConnected ( Body other ) : bool
SynchronizeFixtures ( ) : bool
SynchronizeTransform ( ) : void

Method Details

AllowSleeping() public méthode

You can disable sleeping on this body.
public AllowSleeping ( bool flag ) : void
flag bool
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 ( System.Vector2 force, System.Vector2 point ) : void
force System.Vector2 The world force vector, usually in Newtons (N).
point System.Vector2 The world position of the point of application.
Résultat void

ApplyImpulse() 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 ApplyImpulse ( System.Vector2 impulse, System.Vector2 point ) : void
impulse System.Vector2 The world impulse vector, usually in N-seconds or kg-m/s.
point System.Vector2 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 Torque about the z-axis (out of the screen), usually in N-m.
Résultat void

CreateFixture() public méthode

Creates a fixture and attach it to this body. @warning This function is locked during callbacks.
public CreateFixture ( FixtureDef def ) : Fixture
def FixtureDef The fixture definition.
Résultat Fixture

DestroyFixture() public méthode

Destroy a fixture. This removes the fixture from the broad-phase and therefore destroys any contacts associated with this fixture. All fixtures attached to a body are implicitly destroyed when the body is destroyed. @warning This function is locked during callbacks.
public DestroyFixture ( Fixture fixture ) : void
fixture Fixture The fixture to be removed.
Résultat void

Dispose() public méthode

public Dispose ( ) : void
Résultat void

GetAngle() public méthode

Get the angle in radians.
public GetAngle ( ) : float
Résultat float

GetAngularDamping() public méthode

public GetAngularDamping ( ) : float
Résultat float

GetAngularVelocity() public méthode

Get the angular velocity.
public GetAngularVelocity ( ) : float
Résultat float

GetControllerList() public méthode

public GetControllerList ( ) : ControllerEdge
Résultat Box2DX.Dynamics.Controllers.ControllerEdge

GetFixtureList() public méthode

Get the list of all fixtures attached to this body.
public GetFixtureList ( ) : Fixture
Résultat Fixture

GetInertia() public méthode

Get the central rotational inertia of the body.
public GetInertia ( ) : float
Résultat float

GetJointList() public méthode

Get the list of all joints attached to this body.
public GetJointList ( ) : JointEdge
Résultat JointEdge

GetLinearDamping() public méthode

public GetLinearDamping ( ) : float
Résultat float

GetLinearVelocity() public méthode

Get the linear velocity of the center of mass.
public GetLinearVelocity ( ) : System.Vector2
Résultat System.Vector2

GetLinearVelocityFromLocalPoint() public méthode

Get the world velocity of a local point.
public GetLinearVelocityFromLocalPoint ( System.Vector2 localPoint ) : System.Vector2
localPoint System.Vector2 A point in local coordinates.
Résultat System.Vector2

GetLinearVelocityFromWorldPoint() public méthode

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

GetLocalCenter() public méthode

Get the local position of the center of mass.
public GetLocalCenter ( ) : System.Vector2
Résultat System.Vector2

GetLocalPoint() public méthode

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

GetLocalVector() public méthode

Gets a local vector given a world vector.
public GetLocalVector ( System.Vector2 worldVector ) : System.Vector2
worldVector System.Vector2 A vector in world coordinates.
Résultat System.Vector2

GetMass() public méthode

Get the total mass of the body.
public GetMass ( ) : float
Résultat float

GetMassData() public méthode

Get the mass data of the body.
public GetMassData ( ) : MassData
Résultat Box2DX.Collision.MassData

GetNext() public méthode

Get the next body in the world's body list.
public GetNext ( ) : Body
Résultat Body

GetPosition() public méthode

Get the world body origin position.
public GetPosition ( ) : System.Vector2
Résultat System.Vector2

GetTransform() public méthode

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

GetUserData() public méthode

Get the user data pointer that was provided in the body definition.
public GetUserData ( ) : object
Résultat object

GetWorld() public méthode

Get the parent world of this body.
public GetWorld ( ) : World
Résultat World

GetWorldCenter() public méthode

Get the world position of the center of mass.
public GetWorldCenter ( ) : System.Vector2
Résultat System.Vector2

GetWorldPoint() public méthode

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

GetWorldVector() public méthode

Get the world coordinates of a vector given the local coordinates.
public GetWorldVector ( System.Vector2 localVector ) : System.Vector2
localVector System.Vector2 A vector fixed in the body.
Résultat System.Vector2

IsAllowSleeping() public méthode

public IsAllowSleeping ( ) : bool
Résultat bool

IsBullet() public méthode

Is this body treated like a bullet for continuous collision detection?
public IsBullet ( ) : bool
Résultat bool

IsDynamic() public méthode

Is this body dynamic (movable)?
public IsDynamic ( ) : bool
Résultat bool

IsFixedRotation() public méthode

public IsFixedRotation ( ) : bool
Résultat bool

IsFrozen() public méthode

Is this body frozen?
public IsFrozen ( ) : bool
Résultat bool

IsSleeping() public méthode

Is this body sleeping (not simulating).
public IsSleeping ( ) : bool
Résultat bool

IsStatic() public méthode

Is this body static (immovable)?
public IsStatic ( ) : bool
Résultat bool

PutToSleep() public méthode

Put this body to sleep so it will stop simulating. This also sets the velocity to zero.
public PutToSleep ( ) : void
Résultat void

SetAngle() public méthode

Set the world body angle.
public SetAngle ( float angle ) : void
angle float The new angle of the body in radians
Résultat void

SetAngularDamping() public méthode

public SetAngularDamping ( float angularDamping ) : void
angularDamping float
Résultat void

SetAngularVelocity() public méthode

Set the angular velocity.
public SetAngularVelocity ( float w ) : void
w float
Résultat void

SetBullet() public méthode

Should this body be treated like a bullet for continuous collision detection?
public SetBullet ( bool flag ) : void
flag bool
Résultat void

SetFixedRotation() public méthode

public SetFixedRotation ( bool fixedr ) : void
fixedr bool
Résultat void

SetLinearDamping() public méthode

public SetLinearDamping ( float linearDamping ) : void
linearDamping float
Résultat void

SetLinearVelocity() public méthode

Set the linear velocity of the center of mass.
public SetLinearVelocity ( System.Vector2 v ) : void
v System.Vector2 The new linear velocity of the center of mass.
Résultat void

SetMass() public méthode

Set the mass properties. Note that this changes the center of mass position. If you are not sure how to compute mass properties, use SetMassFromShapes. The inertia tensor is assumed to be relative to the center of mass.
public SetMass ( MassData massData ) : void
massData Box2DX.Collision.MassData The mass properties.
Résultat void

SetMassFromShapes() public méthode

Compute the mass properties from the attached shapes. You typically call this after adding all the shapes. If you add or remove shapes later, you may want to call this again. Note that this changes the center of mass position.
public SetMassFromShapes ( ) : void
Résultat void

SetPosition() public méthode

Set the world body origin position.
public SetPosition ( System.Vector2 position ) : void
position System.Vector2 The new position of the body.
Résultat void

SetStatic() public méthode

public SetStatic ( ) : void
Résultat void

SetTransform() public méthode

Set the position of the body's origin and rotation (radians). This breaks any contacts and wakes the other bodies. Note this is less efficient than the other overload - you should use that if the angle is available.
public SetTransform ( Box2DX.Common.Transform xf ) : bool
xf Box2DX.Common.Transform The Transform of position and angle to set the body to.
Résultat bool

SetTransform() public méthode

Set the position of the body's origin and rotation (radians). This breaks any contacts and wakes the other bodies.
public SetTransform ( System.Vector2 position, Mat22 rotation ) : bool
position System.Vector2 The new world position of the body's origin (not necessarily /// the center of mass).
rotation Box2DX.Common.Mat22
Résultat bool

SetTransform() public méthode

public SetTransform ( System.Vector2 position, Quaternion rotation ) : bool
position System.Vector2
rotation Quaternion
Résultat bool

SetTransform() public méthode

public SetTransform ( System.Vector2 position, float angle ) : bool
position System.Vector2
angle float
Résultat bool

SetUserData() public méthode

Set the user data. Use this to store your application specific data.
public SetUserData ( object data ) : void
data object
Résultat void

WakeUp() public méthode

Wake up this body so it will begin simulating.
public WakeUp ( ) : void
Résultat void

Property Details

bodyID public_oe property

public int bodyID
Résultat int