C# Class FarseerPhysics.Dynamics.Body

Inheritance: IDisposable
Afficher le fichier Open project: prime31/Nez Class Usage Examples

Méthodes publiques

Свойство Type Description
controllerFilter FarseerPhysics.Controllers.ControllerFilter
gravityScale float
ignoreCCD bool
ignoreGravity bool
isBullet bool
islandIndex int
physicsLogicFilter FarseerPhysics.Common.PhysicsLogic.PhysicsLogicFilter
userData object

Méthodes publiques

Méthode Description
Body ( World world, Vector2 position = newVector2(), float rotation, BodyType bodyType = BodyType.Static, object userdata = null ) : System
Dispose ( ) : void
applyAngularImpulse ( float impulse ) : void

Apply an angular impulse.

applyForce ( Vector2 &force ) : void

Applies a force at the center of mass.

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

applyLinearImpulse ( Vector2 impulse ) : void

Apply an impulse at a point. This immediately modifies the velocity. This wakes up the body.

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

clone ( World world = null ) : Body

Makes a clone of the body. Fixtures and therefore shapes are not included. Use DeepClone() to clone the body, as well as fixtures and shapes.

createFixture ( Shape shape, object userData = null ) : Fixture

Creates a fixture and attach it to this body. If the density is non-zero, this function automatically updates the mass of the body. Contacts are not created until the next time step. Warning: This function is locked during callbacks.

deepClone ( World world = null ) : Body

Clones the body and all attached fixtures and shapes. Simply said, it makes a complete copy 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. Warning: This function is locked during callbacks.

getLinearVelocityFromLocalPoint ( Vector2 localPoint ) : Vector2

Get the world velocity of a local point.

getLinearVelocityFromWorldPoint ( Vector2 worldPoint ) : Vector2

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

getLocalPoint ( Vector2 &worldPoint ) : Vector2

Gets a local point relative to the body's origin given a world point. Note that the vector only takes the rotation into account, not the position.

getLocalVector ( Vector2 &worldVector ) : Vector2

Gets a local vector given a world vector. Note that the vector only takes the rotation into account, not the position.

getTransform ( Transform &transform ) : void

Get the body transform for the body's origin.

getWorldPoint ( Vector2 &localPoint ) : Vector2

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

getWorldVector ( Vector2 &localVector ) : Vector2

Get the world coordinates of a vector given the local coordinates. Note that the vector only takes the rotation into account, not the position.

ignoreCollisionWith ( Body other ) : void
resetDynamics ( ) : void

Resets the dynamics of this body. Sets torque, force and linear/angular velocity to 0

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.

restoreCollisionWith ( Body other ) : void
setTransform ( Vector2 &position, float rotation ) : 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.

setTransformIgnoreContacts ( Vector2 &position, float angle ) : void

For teleporting a body without considering new contacts immediately.

Private Methods

Méthode Description
advance ( float alpha ) : void
shouldCollide ( Body other ) : bool

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

synchronizeFixtures ( ) : void
synchronizeTransform ( ) : void

Method Details

Body() public méthode

public Body ( World world, Vector2 position = newVector2(), float rotation, BodyType bodyType = BodyType.Static, object userdata = null ) : System
world World
position Vector2
rotation float
bodyType BodyType
userdata object
Résultat System

Dispose() public méthode

public Dispose ( ) : void
Résultat void

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

Applies a force at the center of mass.
public applyForce ( Vector2 &force ) : void
force Vector2 The force.
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 ( Vector2 force, Vector2 point ) : void
force Vector2 The world force vector, usually in Newtons (N).
point Vector2 The world position of the point of application.
Résultat void

applyLinearImpulse() public méthode

Apply an impulse at a point. This immediately modifies the velocity. This wakes up the body.
public applyLinearImpulse ( Vector2 impulse ) : void
impulse Vector2 The world impulse vector, usually in N-seconds or kg-m/s.
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 ( Vector2 impulse, Vector2 point ) : void
impulse Vector2 The world impulse vector, usually in N-seconds or kg-m/s.
point 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 The torque about the z-axis (out of the screen), usually in N-m.
Résultat void

clone() public méthode

Makes a clone of the body. Fixtures and therefore shapes are not included. Use DeepClone() to clone the body, as well as fixtures and shapes.
public clone ( World world = null ) : Body
world World
Résultat Body

createFixture() public méthode

Creates a fixture and attach it to this body. If the density is non-zero, this function automatically updates the mass of the body. Contacts are not created until the next time step. Warning: This function is locked during callbacks.
public createFixture ( Shape shape, object userData = null ) : Fixture
shape FarseerPhysics.Collision.Shapes.Shape The shape.
userData object Application specific data
Résultat Fixture

deepClone() public méthode

Clones the body and all attached fixtures and shapes. Simply said, it makes a complete copy of the body.
public deepClone ( World world = null ) : Body
world World
Résultat Body

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. Warning: This function is locked during callbacks.
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 ( Vector2 localPoint ) : Vector2
localPoint Vector2 A point in local coordinates.
Résultat Vector2

getLinearVelocityFromWorldPoint() public méthode

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

getLocalPoint() public méthode

Gets a local point relative to the body's origin given a world point. Note that the vector only takes the rotation into account, not the position.
public getLocalPoint ( Vector2 &worldPoint ) : Vector2
worldPoint Vector2 A point in world coordinates.
Résultat Vector2

getLocalVector() public méthode

Gets a local vector given a world vector. Note that the vector only takes the rotation into account, not the position.
public getLocalVector ( Vector2 &worldVector ) : Vector2
worldVector Vector2 A vector in world coordinates.
Résultat Vector2

getTransform() public méthode

Get the body transform for the body's origin.
public getTransform ( Transform &transform ) : void
transform Transform The transform of the body's origin.
Résultat void

getWorldPoint() public méthode

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

getWorldVector() public méthode

Get the world coordinates of a vector given the local coordinates. Note that the vector only takes the rotation into account, not the position.
public getWorldVector ( Vector2 &localVector ) : Vector2
localVector Vector2 A vector fixed in the body.
Résultat Vector2

ignoreCollisionWith() public méthode

public ignoreCollisionWith ( Body other ) : void
other Body
Résultat void

resetDynamics() public méthode

Resets the dynamics of this body. Sets torque, force and linear/angular velocity to 0
public resetDynamics ( ) : void
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

restoreCollisionWith() public méthode

public restoreCollisionWith ( Body other ) : void
other Body
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 ( Vector2 &position, float rotation ) : void
position Vector2 The world position of the body's local origin.
rotation float The world rotation in radians.
Résultat void

setTransformIgnoreContacts() public méthode

For teleporting a body without considering new contacts immediately.
public setTransformIgnoreContacts ( Vector2 &position, float angle ) : void
position Vector2 The position.
angle float The angle.
Résultat void

Property Details

controllerFilter public_oe property

public ControllerFilter,FarseerPhysics.Controllers controllerFilter
Résultat FarseerPhysics.Controllers.ControllerFilter

gravityScale public_oe property

Scale the gravity applied to this body. Defaults to 1. A value of 2 means double the gravity is applied to this body.
public float gravityScale
Résultat float

ignoreCCD public_oe property

public bool ignoreCCD
Résultat bool

ignoreGravity public_oe property

Gets or sets a value indicating whether this body ignores gravity.
public bool ignoreGravity
Résultat bool

isBullet public_oe property

Gets or sets a value indicating whether this body should be included in the CCD solver.
public bool isBullet
Résultat bool

islandIndex public_oe property

public int islandIndex
Résultat int

physicsLogicFilter public_oe property

public PhysicsLogicFilter,FarseerPhysics.Common.PhysicsLogic physicsLogicFilter
Résultat FarseerPhysics.Common.PhysicsLogic.PhysicsLogicFilter

userData public_oe property

Set the user data. Use this to store your application specific data.
public object userData
Résultat object