- Home /
VR - gaze select button that follows camera/head movement
I'm using this script to get a row of 3 buttons to follow with the camera/head movement.
public class FollowCamRotation : MonoBehaviour {
public GameObject cam;
public float speed = 0.5f;
private Vector3 v3Offset;
// Use this for initialization
void Start () {
v3Offset = transform.position - cam.transform.position;
}
// Update is called once per frame
void Update () {
transform.position = cam.transform.position + v3Offset;
transform.rotation = Quaternion.Slerp (transform.rotation, cam.transform.rotation, speed * Time.deltaTime);
transform.localEulerAngles = new Vector3(0, transform.localEulerAngles.y, 0);
}
}
The set of buttons rotates fine but I can only gaze select the center button. The left and right buttons are hard to select because once the head/camera is moved the set of buttons follows to the center again.
Is there a way to get the set of buttons not to follow head movement in a certain range while near the camera center position so the left and right buttons can be selected?
Comment
Your answer
Follow this Question
Related Questions
Radial menu, gameobject follows mouse sync 0 Answers
How can I make a button follow the menu it's attached to? 0 Answers
Camera rotation around player while following. 6 Answers
Player/Camera movement 1 Answer
Smoothly following a moving object 5 Answers