Nouman Khan
Nouman Khan

Reputation: 3

Make VR Camera Looks at Target Game Object

I'm making a VR Application in unity using steam VR, VRTK and HTC Vive. I have a simple Reset Button and what I want is, When I click on that reset button my VR Camera should turn towards the target Game Object and starts looking at it here is my code I use Transform. LookAt but it is not working.

Please help to solve this issue.

Thanks

using UnityEngine;

using System.Collections;

public class reset : MonoBehaviour
{
public Transform target;

public void resetview()
{
    // Rotate the camera every frame so it keeps looking at the target
    transform.LookAt(target);
  }
}

Upvotes: 0

Views: 979

Answers (1)

joreldraw
joreldraw

Reputation: 1736

VR device override everytime the camera rotation of your Player RIG. You need to disable your camera device and enable another camera outside of the VR player RIG and set how main camera. Modify this camera instead of the VR camera RIG.

Upvotes: 0

Related Questions