devNotes 6-17-16 GearVR UI work, user movement and navigation

sfghsfghgsf

 

ad913ff0-6980-4f4a-a690-c6f365f6bddf_scaled

 

 

 

 

ghfjhgfj6

 

 

tumblr_o515shCl8I1r4dhkuo1_500

 

 

 

using UnityEngine;
using System.Collections;

public class FollowCamRotation : MonoBehaviour {
	public GameObject cam;
	public float speed = 0.9f;

    public float xPos = 0;
    public float zPos = 1.5f;
    public float yPos = 1.0f;

    float mag;

    Vector3 vPointing;

    void Start ()
    {
        vPointing = xPos * cam.transform.right + yPos * Vector3.up + zPos * cam.transform.forward;

        mag = Mathf.Sqrt(xPos * xPos + zPos * zPos);
    }


    void Update ()
    {

         Vector3 vPoint = xPos *cam.transform.right + zPos *cam.transform.forward;

        vPoint.y = 0.0f;

        vPoint.Normalize();

        vPoint *= mag;

        vPointing = Vector3.Lerp(vPointing,vPoint, speed * Time.deltaTime);

        vPointing.Normalize();

        vPoint *= mag;

        vPointing.y = yPos;

        transform.position = cam.transform.position + vPointing;

        Quaternion q = Quaternion.LookRotation(cam.transform.position - transform.position);

        transform.forward = cam.transform.forward;


    }
}

ClIs8BIUYAA8Rn7