Urho.Urho2D.RigidBody2D Class

2D rigid body component.

See Also: RigidBody2D


public class RigidBody2D : Component


There are three different kinds of rigid bodies, as defined in BodyType2D. Rigid bodies can be moved/rotated by applying forces and impulses.

Linear force, either progressive or gradual can be applied by using RigidBody2D.ApplyForce and RigidBody2D.ApplyForceToCenter

Linear or angular impuse, either as brutal or immediate can be applied by using RigidBody2D.ApplyLinearImpulse and RigidBody2D.ApplyAngularImpulse.

Torque (angular force) can be controlled by using Urho.Urho2D.RigidBody2D.ApplyTorque.

You should establish the body type at creation, using the RigidBody2D.BodyType property, because changing the body type later is expensive.

You can also directly set the linear or angular velocity of the body using RigidBody2D.LinearVelocity  or RigidBody2D.AngularVelocity

To manually move or rotate a body, simply translate or rotate the node to which it belongs to.

You should set the RigidBody2D.BodyType early on, because changing it at a later time is an expensive operation.


Namespace: Urho.Urho2D
Assembly: Urho (in Urho.dll)
Assembly Versions:

The members of Urho.Urho2D.RigidBody2D are listed below.

See Also: Component

Public Constructors

Constructs a new instance of Urho.Urho2D.RigidBody2D which is tied to the Application.CurrentContext.
Constructs a new instance of Urho.Urho2D.RigidBody2D, given a raw pointer to an unmanaged object
Constructs a new instance of Urho.Urho2D.RigidBody2D linked to a specific Context.

Protected Constructors

Empty constructor, chain to this constructor when you provide your own constructor that sets the handle field.

Public Properties

AllowSleepBoolean. Sets allow sleep flag.
AngularDampingSingle. Return angular damping. Or Set angular damping.
AngularVelocitySingle. Return angular velocity. Or Set angular velocity.
AwakeBoolean. Controls the Awake mode.
BodyTypeBodyType2D. Return body type. Or Set body type.
BulletBoolean. Controls the bullet mode.
FixedRotationBoolean. Controls whether rotation is fixed.
GravityScaleSingle. Return gravity scale. Or Set gravity scale.
InertiaSingle. Return inertia. Or Set inertia.
LinearDampingSingle. Return linear damping. Or Set linear damping.
LinearVelocityVector2. Return linear velocity.
MassSingle. Return mass. Or Set mass.
MassCenterVector2. Return mass center.
TypeStringHash. Urho's type system type.
TypeNameString. Urho's low-level type name.
TypeNameStaticString. Urho's low-level type name, accessible as a static method.
TypeStaticStringHash. Urho's low-level type, accessible as a static method.
UseFixtureMassBoolean. Return whether to calculate mass and inertia from collision shapes automatically. Or Set whether to automatically calculate mass and inertia from collision shapes. Default true.

Public Methods

Add collision shape.
Add constraint.
ApplyAngularImpulse(Single, Boolean)
Apply angular impulse.
ApplyForce(Vector2, Vector2, Boolean)
Apply force.
ApplyForceToCenter(Vector2, Boolean)
Apply force to center.
ApplyLinearImpulse(Vector2, Vector2, Boolean)
Apply linear impulse.
ApplyTorque(Single, Boolean)
Apply Torque.
Apply world transform.
ApplyWorldTransform(Vector3, Quaternion)
Applies the specified world osition and rotation.
Create body.
Handle enabled/disabled state change.
Register object factory.
Release body.
Remove collision shape.
Remove constraint.
Set linear velocity.
Set mass center.