Forum Discussion
AADProductions
10 years agoExplorer
Best practice for camera rotation offset in Unity 5
I'm working on a game where you spend a lot of time looking down and it's making people a bit uncomfortable. I'd like to add a 45° offset to the camera's x rotation to take the strain off their necks ...
AADProductions
10 years agoExplorer
"cybereality" wrote:Hi cybereality - thanks for the script, I can tell I wasn't clear enough about what I needed guidance with. I'm already up to speed with making the camera a child of an empty and rotating/translating it in general.
You just need to make the camera a child of an empty.
Look at my code here for an example of how to do it:
viewtopic.php?f=37&t=24460#p285046
The specific problem I'm trying to solve is how to rotate the parent to match the result I'd get when doing this in the old OVRCameraRig:
trackerAnchor.localRotation = tracker.orientation;
trackerAnchor.Rotate (45f, 0f, 0f);//add a constant offset to x rotation
When I rotate the parent 45 degrees on its x axis and do nothing else, the child camera's horizon gets tilted as you turn your head - the more its forward direction differs from the parent's forward direction, the worse it gets.
To fix this I'd normally copy the camera's rotation to the parent and zero out the camera's rotation before applying the 45 degree rotation to the parent's x axis. But since I can't zero out the camera's rotation, I'm not sure how to get the same result.
Hope I'm making sense. I'm guessing it's super simple if you're a whiz with quaternions but I'm at a loss.
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
- 9 years agoAnonymous
- 11 months ago
- 5 months ago
- 2 years ago