コード例 #1
0
    private void Rotate(float linearVelocity)
    {
        float angularVelocity = UtilCircle.AngularVelocityDegrees(linearVelocity, radius)
                                * UtilMath.Sign(inverted);

        mover.OffsetRotation(angularVelocity);
    }
コード例 #2
0
ファイル: UtilMath.cs プロジェクト: NivMizzle/NotTheFace
 // Like the Approach function, but rotates current along the shortest path to target.
 public static float ApproachAngleDegrees(float current, float target, float stepSize)
 {
     current = UtilCircle.AngleDegreesToUnsignedRange(current);
     target  = UtilCircle.AngleDegreesToUnsignedRange(target);
     if (UtilCircle.AngleDegreesToUnsignedRange(Mathf.Abs(current - target)) < stepSize)
     {
         return(target);
     }
     current += stepSize * UtilCircle.SignShortestRotationDegrees(current, target);
     return(current);
 }
コード例 #3
0
ファイル: UpDirection2D.cs プロジェクト: NivMizzle/NotTheFace
 private void NormalizeAngle()
 {
     upAngle = UtilCircle.AngleDegreesToUnsignedRange(upAngle);
 }