Urho.Urho2D.ConstraintMouse2D Class

2D mouse constraint component.

See Also: ConstraintMouse2D


public class ConstraintMouse2D : Constraint2D


Used to manipulate bodies with the mouse.  

This constraint is almost used in every Box2D tutorial available on the net, to allow interacting with the 2D scene. 

It attempts to drive a point on a body towards the current position of the cursor. There is no restriction on rotation. This constraint has a target point, maximum force, frequency, and damping ratio. 

The target point ConstraintMouse2D.Target initially coincides with the body’s anchor point. The maximum force ConstraintMouse2D.MaxForce is used to prevent violent reactions when multiple dynamic bodies interact. You can make this as large as you like. The frequency ConstraintMouse2D.FrequencyHz and damping ratio ConstraintMouse2D.DampingRatio are used to create a spring/damper effect similar to the ConstraintDistance2DConstraintDistance2D. 

Many users have tried to adapt the ConstraintMouse2D for game play. Users often want to achieve precise positioning and instantaneous response. The ConstraintMouse2D doesn’t work very well in that context. You may wish to consider using kinematic bodies instead.


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

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

See Also: Constraint2D

Public Constructors

Constructs a new instance of Urho.Urho2D.ConstraintMouse2D which is tied to the Application.CurrentContext.
Constructs a new instance of Urho.Urho2D.ConstraintMouse2D, given a raw pointer to an unmanaged object
Constructs a new instance of Urho.Urho2D.ConstraintMouse2D 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

DampingRatioSingle. Return damping ratio. Or Set damping ratio.
FrequencyHzSingle. Return frequency Hz. Or Set frequency Hz.
MaxForceSingle. Return max force. Or Set max force.
TargetVector2. Return target. Or Set target.
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.

Public Methods

Register object factory.