Skip to content

Commit a6a1c72

Browse files
committed
Enable strafing backwards with motion controllers, and only strafe along the y axis
1 parent 365af4d commit a6a1c72

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Assets/HoloToolkit/Input/Scripts/Gaze/MixedRealityTeleport.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,15 @@ private void InteractionManager_InteractionSourceUpdated(InteractionSourceUpdate
148148
}
149149
}
150150

151-
if (EnableRotation && !teleporting)
151+
if (EnableStrafe && !teleporting && !fadeControl.Busy)
152+
{
153+
if (obj.state.thumbstickPosition.y < -0.8 && Math.Abs(obj.state.thumbstickPosition.x) < 0.2)
154+
{
155+
DoStrafe(Vector3.back * StrafeAmount);
156+
}
157+
}
158+
159+
if (EnableRotation && !teleporting && !fadeControl.Busy)
152160
{
153161
if (obj.state.thumbstickPosition.x < -0.8 && Math.Abs(obj.state.thumbstickPosition.y) < 0.2)
154162
{
@@ -215,6 +223,8 @@ public void DoStrafe(Vector3 strafeAmount)
215223
0.25f, // Fade in time
216224
() => // Action after fade out
217225
{
226+
Transform transformToRotate = Camera.main.transform;
227+
transformToRotate.rotation = Quaternion.Euler(0, transformToRotate.rotation.eulerAngles.y, 0);
218228
transform.Translate(strafeAmount, Camera.main.transform);
219229
}, null); // Action after fade in
220230
}

0 commit comments

Comments
 (0)