So I have a script that scales SteamVR CameraRig up and down:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class C_Pivot : MonoBehaviour {
public GameObject target;
public GameObject cameraRig;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
transform.position = new Vector3(target.transform.position.x, cameraRig.transform.position.y, target.transform.position.z);
}
}
But it can only pivot from the center of the rig regardless of where the “head” is. I want the scale to pivot from another game object let’s call it “pivot” that follows the “head” on x and z but sticks to the CameraRig’s y which is the ground:
pivot.transform.position = new Vector3(head.transform.position.x, cameraRig.transform.position.y, head.transform.position.z);
Problem is, I cannot parent the CameraRig to a pivot object for various reasons. It would be ideal for me if I can make any game object the pivot.
Thanks in advance for any suggestions.