How do I offset a camera when it's position is defined by a VR controller
Hi everyone,
I'm doing a project with the Oculus Rift and Unity. Currently, i'm using the left hand controller as a VR Object and have written this script as a component of a camera in unity. It makes the camera follow the exact position of the hand controller.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TrackVRObjectMaster : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
OVRPose p = OVRPlugin.GetNodePose(OVRPlugin.Node.DeviceObjectZero, OVRPlugin.Step.Render).ToOVRPose();
if (OVRPlugin.GetNodePositionTracked(OVRPlugin.Node.DeviceObjectZero))
{
this.transform.position = p.position;
}
if (OVRPlugin.GetNodeOrientationTracked(OVRPlugin.Node.DeviceObjectZero))
{
this.transform.rotation = p.orientation;
}
}
}
I need to create another camera that does the same thing, but offset the position 50 units forward on the z axis.
I've tried parenting to a game object and moving that, but the script is overriding it and putting both cameras to the exact same position in 3D space.
Any thoughts on how to move the camera back?
Thanks,
Darren
Your answer
Follow this Question
Related Questions
Planet Earth at real scale in Unity possible? 0 Answers
Creating a Reticle with Google Cardboard SDK 3 Answers
c# - error CS0103: The name `hit' does not exist in the current context (cardboard switching) 1 Answer
Navigation in VR Mode?!! 0 Answers
Tracked Pose Driver has position support range error on VR 0 Answers