cancel
Showing results for 
Search instead for 
Did you mean: 

Camera Offset from Player Problem, inaccurate collision (SOLVED)

amadeus_bojiuc
Honored Guest
Basically my camera is always offset from the player due to the head tracking. This is problematic because the player handles the collisions. The camera is a child of the player and should remain at it's origin.

How can I make it so that that the head tracking moves the player instead of the camera?

Basically I want the tracking to move the player and the camera together, not the camera away from the player.



1 REPLY 1

amadeus_bojiuc
Honored Guest
The latest version of both (Unity 5.6.3)

I found a solution for this.
Create a parent object for the camera inside the player object. Make the camera a child of this cam holder object.

The cam holder's position will be the opposite of whatever the camera's offset is. So if the camera is offset by -1, then this object will be offset by 1 making it centered on the player. This can be achieved with a simple line of code on the cam holder object.

public Transform Main_Camera;

transform.localPosition = new Vector3 (-Main_Camera.localPosition.x,0, -Main_Camera.localPosition.z);

Simple as that.