Forum Discussion
Qwonfu
12 years agoHonored Guest
Rotation threshold used for continual player rotation
Hello,
I'm trying to develop a control scheme where you rotate your head/Rift outside of a certain threshold, then continual rotation will be applied to the player object until you rotate your head/Rift back within the threshold. I've successfully modified the OVRCameraController and OVRCamera classes to apply rotation around the X axis to the ForwardDirection Transform object and that works fine. My problem is finding the correct way to determine how far the Rift has rotated on any specific axis to test against the threshold values.
I'm currently thinking about using the Quaternion from OVRDevice.GetOrientation to set a starting point and then continually test axis values from that Quaternion to determine if I've passed a specified threshold. Hopefully this idea isn't completely bonkers. Anyone have other ideas? Any help greatly appreciated, thanks!
OCULUS RULES!
I'm trying to develop a control scheme where you rotate your head/Rift outside of a certain threshold, then continual rotation will be applied to the player object until you rotate your head/Rift back within the threshold. I've successfully modified the OVRCameraController and OVRCamera classes to apply rotation around the X axis to the ForwardDirection Transform object and that works fine. My problem is finding the correct way to determine how far the Rift has rotated on any specific axis to test against the threshold values.
I'm currently thinking about using the Quaternion from OVRDevice.GetOrientation to set a starting point and then continually test axis values from that Quaternion to determine if I've passed a specified threshold. Hopefully this idea isn't completely bonkers. Anyone have other ideas? Any help greatly appreciated, thanks!
OCULUS RULES!
6 Replies
- dbuckHonored GuestThat could work, but how about something a little more random, bad code, but easier to get rolling to prototype your idea quickly.
Assuming unity..
(On a separate physics layer, you can set them on the objects, and in the Physics preferences menu to not interact with the rest of the scene...)
attach a set of colliders set to trigger that are to the left and right of the player body
have a second collider as a child of the camera controller (On a stick basically sticking out of your face..)
when the face collider enters the left body OnTriggerEnter(), rotate the body 'left' until it hits the OnTriggerExit();
tweak the positions of your 'body' colliders, and the speed of your rotation to suit.
like I said, shit code for optimum performance, but cake to test/play/experiment with to see if your idea works and to play with tweaking the speeds/etc before implementing it nicely. - QwonfuHonored GuestDBuck,
Yeah Unity, forgot to mention that :)
That's a really good idea and should work nicely to get me up and running quickly. Thanks! - Mithos56ExplorerI had planned to do the same thing, but instead of causing rotation directly, to trigger a mechanim animation for rotation(So pretty much the exact same thing).
I had planned on just testing the rotation from the rift, what problems with doing that directly are you having?
edit -
I started implementing this, and I've had a lot of luck just polling the rotation of one of the cameras. I just used a rotation.eulerAngle.y so see if I've passed my limits. Works pretty well. - QwonfuHonored GuestThe rotation.eulerAngle.y was what I was looking for. My main issue is that I'm a Unity noob and making beginner mistakes, having fun though :) Thanks for the helpful suggestions!
- dbuckHonored GuestI tried it out, it seems to feel strange. now that I think about it a bit more, my directions wont work with the standard OVRPlayerController, I've got mine rigged up with a separate body / head mechanism.
I think I like it better than using the right stick to turn, but It might just need some tuning and falloff curves to make it feel decent. I'll leave it as an option in the next build for my sandbox thing
what do you guys think so far? - QwonfuHonored GuestYeah, it played better it my mind. Once I had it up and running it was a bit awkward. I'm going back to using the controller to rotate the player and use the head tracking for targeting . I was attempting to do the reverse.
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
- 6 months ago