InertiaRotationBehavior2D.DesiredRotation 属性

定义

获取或设置预期的旋转(以弧度为单位)。

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

属性值

Single

预期的旋转(以弧度为单位)。

示例

在以下示例中,该 DesiredRotation 属性设置为使惯性处理能够从其起始方向旋转三次半次对象。

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

注解

此属性表示惯性操作的所需结束旋转。 此属性值与属性互斥 DesiredDeceleration ;将此属性设置为 DesiredDeceleration NaN。 此属性的默认值为 DesiredDeceleration NaN. 在惯性处理开始之前,必须设置一个或另一个属性。

DesiredRotation 必须是有限的非负数。 旋转方向由 InitialVelocity 属性确定。

当惯性处理器正在运行时,无法设置此属性;否则,将引发异常。

适用于