Forum Discussion
JohnnyLincoln
5 years agoHonored Guest
Constrain grabbable object motion in Unity
I want to open a window by grabbing it and pulling open up and down. How can I constrain the movement of the window using the Oculus's Unity package?
If you're using OVRGrabbable instead of just interacting with a rigidbody then I think the classic workaround is to grab an invisible object that then drives the movement of your window. It's the technique described in this video for a door but a window would be the same. https://www.youtube.com/watch?v=3cJ_uq1m-dg&t=129s
3 Replies
Replies have been turned off for this discussion
The constrain isn't really anything to do with The Oculus SDK, it's a Unity thing. If your window is a physics object with a rigidbody you can constrain the X, Y, Z movement on that component by using the Freeze Position tick boxes: https://docs.unity3d.com/Manual/class-Rigidbody.html (you'll probably also want to freeze rotations)
- JohnnyLincolnHonored Guest
Thanks for the response. I tried constraining the movement in that way but the OVR Grabbable script seems to override it.
If you're using OVRGrabbable instead of just interacting with a rigidbody then I think the classic workaround is to grab an invisible object that then drives the movement of your window. It's the technique described in this video for a door but a window would be the same. https://www.youtube.com/watch?v=3cJ_uq1m-dg&t=129s
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 months ago
- 2 years ago
- 4 years ago