- Home /
How to make an object always in front of the OVRPlayerController camera?
I already try to do the hierarchy of the object inside the OVRPlayerController camera, but only the object follows the camera at the sides, but when I look up or down the object no longer follows it. Can you help me please?
Have you tried adding the object as a child to the camera, with 0 rotation and only position difference in +z? That's what I do, and the object is always in front of the VR camera.
If that doesn't work, can you show or describe (in detail) the object hierarchy?
Well what I did was put as a child of TrackingSpace not OVRPlayerController. And deactivate where it says Hmd reset Y and it was all and it worked. But thanks for the advice.
Answer by KittenSnipes · Mar 19, 2018 at 06:02 AM
Something like that should work.
public Transform target;
public float offset = 10;
void Update () {
target.position = transform.position + transform.forward * offset;
target.rotation = new Quaternion(0.0f, transform.rotation.y, 0.0f, transform.rotation.w);
}
Thank you very much worked well. And it can also work by inheriting directly from TrackingSpace.