Urho.Urho2D.RigidBody2D Class

2D rigid body component.

See Also: RigidBody2D

Syntax

public class RigidBody2D : Component

Remarks

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.

Requirements

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

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.
[read-only]
LinearVelocityVector2. Return linear velocity.
MassSingle. Return mass. Or Set mass.
[read-only]
MassCenterVector2. Return mass center.
[read-only]
override
TypeStringHash. Urho's type system type.
[read-only]
override
TypeNameString. Urho's low-level type name.
[read-only]
static
TypeNameStaticString. Urho's low-level type name, accessible as a static method.
[read-only]
static
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

AddCollisionShape2D(CollisionShape2D)
Add collision shape.
AddConstraint2D(Constraint2D)
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.
ApplyWorldTransform()
Apply world transform.
ApplyWorldTransform(Vector3, Quaternion)
Applies the specified world osition and rotation.
CreateBody()
Create body.
override
OnSetEnabled()
Handle enabled/disabled state change.
static
RegisterObject(Context)
Register object factory.
ReleaseBody()
Release body.
RemoveCollisionShape2D(CollisionShape2D)
Remove collision shape.
RemoveConstraint2D(Constraint2D)
Remove constraint.
SetLinearVelocity(Vector2)
Set linear velocity.
SetMassCenter(Vector2)
Set mass center.