Skip to content

Commit 0070959

Browse files
phatboyshthestonefox
authored andcommitted
fix(Locomotion): continuous rotation in DragWorld
Changed vector math to allow for continuous rotation.
1 parent 12cd070 commit 0070959

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Assets/VRTK/Source/Scripts/Locomotion/VRTK_DragWorld.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ protected virtual void Rotate()
386386
if (rotationTrackingController == TrackingController.BothControllers && VRTK_ControllerReference.IsValid(leftControllerReference) && VRTK_ControllerReference.IsValid(rightControllerReference))
387387
{
388388
Vector2 currentRotationAngle = GetControllerRotation();
389-
float newAngle = Vector2.Angle(currentRotationAngle, previousRotationAngle) * Mathf.Sign(currentRotationAngle.x * currentRotationAngle.y - previousRotationAngle.x * previousRotationAngle.y);
389+
float newAngle = Vector2.Angle(currentRotationAngle, previousRotationAngle)*Mathf.Sign(Vector3.Cross(currentRotationAngle, previousRotationAngle).z);
390390
RotateByAngle(newAngle);
391391
previousRotationAngle = currentRotationAngle;
392392
}
@@ -430,4 +430,4 @@ protected virtual void Scale()
430430
previousControllerDistance = currentDistance;
431431
}
432432
}
433-
}
433+
}

0 commit comments

Comments
 (0)