Click or drag to resize

Body Methods

The Body type exposes the following members.

Methods
 NameDescription
Public methodAdd Warning: This method is locked during callbacks.
Public methodApplyAngularImpulse Apply an angular impulse.
Public methodApplyForce(Vector2) Applies a force at the center of mass.
Public methodApplyForce(Vector2) Applies a force at the center of mass.
Public methodApplyForce(Vector2, Vector2) 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 methodApplyForce(Vector2, Vector2) 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 methodApplyLinearImpulse(Vector2) Apply an impulse at a point. This immediately modifies the velocity. This wakes up the body.
Public methodApplyLinearImpulse(Vector2) Apply an impulse at a point. This immediately modifies the velocity. This wakes up the body.
Public methodApplyLinearImpulse(Vector2, Vector2) 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 methodApplyLinearImpulse(Vector2, Vector2) 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 methodApplyTorque Apply a torque. This affects the angular velocity without affecting the linear velocity of the center of mass. This wakes up the body.
Public methodClone 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 methodCreateChainShape 
Public methodCreateCircle(Single, Single) 
Public methodCreateCircle(Single, Single, Vector2) 
Public methodCreateCompoundPolygon 
Public methodCreateEdge 
Public methodCreateEllipse 
Public methodCreateFixture 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 method is locked during callbacks.
Public methodCreateLineArc 
Public methodCreateLoopShape 
Public methodCreatePolygon 
Public methodCreateRectangle 
Public methodCreateSolidArc 
Public methodDeepClone Clones the body and all attached fixtures and shapes. Simply said, it makes a complete copy of the body.
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetLinearVelocityFromLocalPoint(Vector2) Get the world velocity of a local point.
Public methodGetLinearVelocityFromLocalPoint(Vector2) Get the world velocity of a local point.
Public methodGetLinearVelocityFromWorldPoint(Vector2) Get the world linear velocity of a world point attached to this body.
Public methodGetLinearVelocityFromWorldPoint(Vector2) Get the world linear velocity of a world point attached to this body.
Public methodGetLocalPoint(Vector2) Gets a local point relative to the body's origin given a world point.
Public methodGetLocalPoint(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.
Public methodGetLocalVector(Vector2) Gets a local vector given a world vector. Note that the vector only takes the rotation into account, not the position.
Public methodGetLocalVector(Vector2) Gets a local vector given a world vector. Note that the vector only takes the rotation into account, not the position.
Public methodGetTransform Get the body transform for the body's origin.
Public methodGetTransform(Transform) Get the body transform for the body's origin.
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodGetWorldPoint(Vector2) Get the world coordinates of a point given the local coordinates.
Public methodGetWorldPoint(Vector2) Get the world coordinates of a point given the local coordinates.
Public methodGetWorldVector(Vector2) Get the world coordinates of a vector given the local coordinates.
Public methodGetWorldVector(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.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodRemove 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 method is locked during callbacks.
Public methodResetDynamics Resets the dynamics of this body. Sets torque, force and linear/angular velocity to 0
Public methodResetMassData 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 methodSetCollidesWith Warning: This method applies the value on existing Fixtures. It's not a property of Body.
Obsolete
Public methodSetCollisionCategories Warning: This method applies the value on existing Fixtures. It's not a property of Body.
Obsolete
Public methodSetCollisionGroup Warning: This method applies the value on existing Fixtures. It's not a property of Body.
Obsolete
Public methodSetFriction Set friction on all fixtures. Warning: This method applies the value on existing Fixtures. It's not a property of Body.
Obsolete
Public methodSetIsSensor Warning: This method applies the value on existing Fixtures. It's not a property of Body.
Obsolete
Public methodSetRestitution Set restitution on all fixtures. Warning: This method applies the value on existing Fixtures. It's not a property of Body.
Obsolete
Public methodSetTransform(Vector2, Single) 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. Warning: This method is locked during callbacks.
Public methodSetTransform(Vector2, Single) 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. Warning: This method is locked during callbacks.
Public methodSetTransformIgnoreContacts For teleporting a body without considering new contacts immediately. Warning: This method is locked during callbacks.
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Extension Methods
 NameDescription
Public Extension MethodMethodInvoke Calls the object method by name.
(Defined by ObjectEx)
Public Extension MethodPropertyGet Gets the value of the object property by name.
(Defined by ObjectEx)
Public Extension MethodPropertyGetT Gets the value of the object property by name.
(Defined by ObjectEx)
Public Extension MethodPropertySet Sets the value of the object property by name.
(Defined by ObjectEx)
Top
See Also