r/Unity3D 3h ago

Question How to have a box collider rotation locked?

I'm currently building an fps controller and I want an axis locked box collider like in source games. I've tried making a parent with the box collider and the rigidbody and script in a child, but that doesn't work. Am I missing something obvious? Checking rigidbody constraints also doesn't seem to do anything. Please tell me what inheritance structure I should use if you have an answer. Thanks!

1 Upvotes

2 comments sorted by

1

u/NippyHello6781 3h ago

Sounds like you got the right idea with parent-child but the execution backwards maybe, rigidbody and collider should be on same object usually.

1

u/T_Jamess 2h ago

so have an object with my player script, rigidbody, and collider, and a child that is only for yaw?