How to make HTC Vive HMD move and rotate non-camera object?

SOLVED
jarileon
Contributor

How to make HTC Vive HMD move and rotate non-camera object?

Hi all.

 

I am making an application with Unity where I wan the Vive HMD control a dummy gameobject, which is NOT the GameObject where the camera(s) are located. The cameras would be under a separate game object, which I would move on every frame based on the  dummy objects position and rotation. 

The reason for this is I want to apply a multiplier to the HMD movement  - for example when HMD moves 10 inches in the real world, I would want the VR camera to move 200 inches (when the

multiplier is set to 20). 

 

I looked at the CameraRig prefab, but could not figure out how to achieve the desired behavior. Do I need to dig in deeper to the vive API?

 

Any help in how to accomplish this would be much appreciated! 

Highlighted
jarileon
Contributor
Solution

Re: How to make HTC Vive HMD move and rotate non-camera object?

I figured out a solution to this. In case someone else needs to achieve the same kind of behavior, it can be achieved by adding a parent object to the camera rig and setting its scale to 0,0,0. This disabled the HMD movement. Then I simply re-enable the movement by doing this in Update():

 

transform.position = InputTracking.GetLocalPosition(VRNode.Head) * positionScalar;        

Vive Staff

Re: How to make HTC Vive HMD move and rotate non-camera object?

Thanks for adding your solution! I'm sorry I wasn't able to help on this one (I'm a UE4 dev) but I'm glad you were able to figure everything out.

- David R

Technical Specialist; San Francisco, CA