I was trying to use RigidbodyConstraints to freeze a cube’s x and z position. I then used Debug.Log(rigidbody.constraints) to print the constraints. When I ran the game, It printed only(I checked all the Debug.LOg stuff in the console) position x, the one I set to freeze second. Is there a way to freeze both?
2 Answers
2It literally says in the documentation how, and even uses it in the example:
you just put | (the bitwise or operator) inbetween the two constraints
Just you need to check freeze Position on rigid body
Oh whoops. Thank you.
– jg2115The doc link specifies only Rotation, not Position and nothing seems to work if you change "Rotation" to "Position", so I'm still not getting the expected results either. jg2115, were you able to figure it out?
– jamiedjohnsonYou can use FreezePosition instead of FreezeRotation, it ended up working for me.
– jg2115