แก้ไข

แชร์ผ่าน


InertiaRotationBehavior2D.DesiredRotation Property

Definition

Gets or sets the desired rotation, in radians.

public:
 property float DesiredRotation { float get(); void set(float value); };
public float DesiredRotation { get; set; }
member this.DesiredRotation : single with get, set
Public Property DesiredRotation As Single

Property Value

The desired rotation, in radians.

Examples

In the following example, the DesiredRotation property is set to enable inertia processing to rotate an object three-and-one-half times from its starting orientation.

#region SetDesiredRotation
// PI * 2 radians = 360 degrees.
inertiaProcessor.RotationBehavior.DesiredRotation = (float)Math.PI * 7.0f;
#endregion

Remarks

This property represents the desired ending rotation of the inertia operation. This property value is mutually exclusive with the DesiredDeceleration property; setting this property will set DesiredDeceleration to NaN. The default value for both this property and DesiredDeceleration is NaN. You must set one or the other property before inertia processing starts.

DesiredRotation must be a finite, non-negative number. The direction of rotation is determined by the InitialVelocity property.

This property cannot be set while the inertia processor is running; otherwise, an exception is thrown.

Applies to