3rd person space shooter
I am making a third person space shooter. I want to fly in the direction I am looking, i have the camera attached to the ship, but the problem i have is that when I turn the ship goes out of view. For example if I turn 90 degrees to the left my camera and ship will face left but the ship's position is still in front of the camera in the z direction instead of the x. One thing I thought might work would be to rotate the ship around the camera or the camera around the ship when I turn, or to disable head tracking because it works fine in unity using the mouse to steer but I don't know how. I don't know if this makes sense, but I don't know how to explain it. If anyone has a solution I would appreciate it. Also I am new to VR and unity so if you could explain it in detail it would help a lot thanks.
This is the code I am using to turn the ship.
This is the code I am using to turn the ship.
public class AlignToTracker : MonoBehaviour {
public Transform hmdOrientation; //in the inspector add the "OVRCameraRig/CenterEyeAnchor"
private float adjustPos=1;
private Vector3 tempRot;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
tempRot.x = hmdOrientation.localEulerAngles.x;
tempRot.y = hmdOrientation.localEulerAngles.y;
tempRot.z = hmdOrientation.localEulerAngles.z;
//update head rotation
transform.localEulerAngles = tempRot;
}
}