- Home /
Lock axis/rotation on 2d plane with capsule collider
I have a GameObject with a RigidBody, a capsule collider and a plane attached to it. The capsule rolls down a hill with the plane facing Z. This works fine until the collider hits obstacles and starts to rotate in every direction. This is supposed to simulate 2d and I would like to lock the collision/rotation/position in the Z-axis. I have read about Configurable Joint but I cant seem to get it to work right. What parameter should I be looking for? Is it better to do this with code in the controller script?
Answer by Mattias-Wargren · Mar 02, 2011 at 11:58 AM
Fixed it with the Configurable Joint locking ZMotion, Angular XMotion, Angular YMotion. Hope this can help others with the same problem.
Answer by efge · Jan 19, 2011 at 10:47 AM
For your 2D plane you could use the function LookAt.
And there is already an answer how to lock the rotation in one axis: Locking LookAt.
Thanks. But I dont want the plane to look at anything. Think of a rolling coin, but it never falls over.