Forum Discussion
modhdhruv
6 years agoExplorer
How to move Player in Hand tracking
How to do the movement of a player while using hand tracking in the oculus quest? Anyone have done Player movement? Have tried to move OVRCameraRig with joystick four-button forward/backward/left/rig...
Stimmits
6 years agoExplorer
modhdhruv said:
Tried to change in UpdatePose() HandSkeleton.cs.Now how to move OVRCameraRig in the center camera direction is looking?transform.position = pose.RootPose.Position.FromFlippedZVector3f() + OVRCameraRig.transform.localPosition;
- Hand moving perfectly with OVRCameraRig.
Note that adding positions this way does not account for local rotated translation of the OVRCameraRig, which InverseTransformPoint does do.
You can test this by rotating the OVRCameraRig 90 degrees on the Y axis. Your hands will appear left/right next to you if you add the positions, and still in front of you when using InverseTransformPoint. Note that the returned position is then also affected by scale, which is a good thing in this case.
Moving the OVRCameraRig in the direction the camera is looking - can be done by calculating a flat rotation and translating forward in that direction, doing something like this:
float speed = 2.0f;
Transform ovrCameraRig;
void Update () {
Quaternion headRotationFlat = Quaternion.Euler(0, Camera.main.transform.eulerAngles.y, 0);
ovrCameraRig.transform.Translate((headRotationFlat * Vector3.forward) * speed * Time.deltaTime, Space.World);
}But there are many alternatives to this. Try and see which solution works best for your application. Maybe yours is better suited to incorporate teleportation locomotion for example?
You can also try and check out the new Unity XR Interaction Toolkit. Can't link it here, but try and google it, you'll find it really quick. It's also in the Unity Package Manager. It allows you to use some really nifty 'drag-and-drop' teleportation, interaction and more XR-based components.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 3 years ago
- 9 months ago
- 2 years ago