Skip to content

Commit

Permalink
fix(Locomotion): continuous rotation in DragWorld
Browse files Browse the repository at this point in the history
Changed vector math to allow for continuous rotation.
  • Loading branch information
phatboysh authored and thestonefox committed Dec 22, 2017
1 parent 12cd070 commit 0070959
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Assets/VRTK/Source/Scripts/Locomotion/VRTK_DragWorld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ protected virtual void Rotate()
if (rotationTrackingController == TrackingController.BothControllers && VRTK_ControllerReference.IsValid(leftControllerReference) && VRTK_ControllerReference.IsValid(rightControllerReference))
{
Vector2 currentRotationAngle = GetControllerRotation();
float newAngle = Vector2.Angle(currentRotationAngle, previousRotationAngle) * Mathf.Sign(currentRotationAngle.x * currentRotationAngle.y - previousRotationAngle.x * previousRotationAngle.y);
float newAngle = Vector2.Angle(currentRotationAngle, previousRotationAngle)*Mathf.Sign(Vector3.Cross(currentRotationAngle, previousRotationAngle).z);
RotateByAngle(newAngle);
previousRotationAngle = currentRotationAngle;
}
Expand Down Expand Up @@ -430,4 +430,4 @@ protected virtual void Scale()
previousControllerDistance = currentDistance;
}
}
}
}

0 comments on commit 0070959

Please sign in to comment.