Forum Discussion
amadeus.bojiuc
9 years agoHonored Guest
Camera Offset from Player Problem, inaccurate collision (SOLVED)
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.
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
Replies have been turned off for this discussion
- amadeus.bojiucHonored GuestThe 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.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 2 months ago
- 2 years ago