Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

How to let an object free rotate by gestures?

In Academic 211, I learned the following two lines of codes, which help me to controlling the object rotates alone the Y-axis, that are,
// Calculate rotationFactor based on GestureManager's NavigationPosition.X and multiply by // RotationSensitivity. This will help control the amount of rotation.
rotationFactor = GestureManager.Instance.NavigationPosition.x * RotationSensitivity;
// 2.c: transform.Rotate along the Y axis using rotationFactor.
transform.Rotate(new Vector3(0, 0, -1 * rotationFactor));

In the file GestureManager, I learned the following code, that is,
// 2.b: Add Tap and NavigationX GestureSettings to the NavigationRecognizer's RecognizableGestures.
NavigationRecognizer.SetRecognizableGestures(
GestureSettings.Tap |
GestureSettings.NavigationX
);

So I wonder, if I want to rotate an object in free mode, which means 360 degrees in any directions, I should change the code as following:
// 2.b: Add Tap and NavigationX, NavigationY, NavigationZ GestureSettings to the NavigationRecognizer's RecognizableGestures.
NavigationRecognizer.SetRecognizableGestures(
GestureSettings.Tap |
GestureSettings.NavigationX |
GestureSettings.NavigationY |
GestureSettings.NavigationZ
);

and adds next 3 lines of codes up rotationFactorX, rotationFactorY, rotationFactorZ
rotationFactorX = GestureManager.Instance.NavigationPosition.x * RotationSensitivity;
rotationFactorY = GestureManager.Instance.NavigationPosition.y * RotationSensitivity;
rotationFactorZ = GestureManager.Instance.NavigationPosition.z * RotationSensitivity;

But the NavigationY and NavigationZ seem not functional at all.
Can any one give me some suggestions how to fix this issue.

Thank You,
M

Answers

Sign In or Register to comment.