Body Constraints

Feb 26, 2008 at 7:03 PM
I found JigLibX over the weekend and started to play around with it, and I think I have the basics down.

I'm trying to prevent a body from moving in the Z axis. I searched around and found Body.AddConstraint(). I added a ConstraintVelocity, but it doesn't seem to have any effect. I searched through the code and I can't see where constraints are applied. Am I going about this the wrong way, or is this feature not active yet?
Feb 28, 2008 at 1:09 PM
After playing around with them for a bit more, I found that constraints should be added directly to the physics system. However, they don't do what I expect them to do. ConstraintVelocity doesn't set a limit for velocity, it sets the velocity.

I did find a way to limit movement in the Z direction. I extended the body class and in the PostPhysics() method added Velocity = new Vector3(Velocity.X, Velocity.Y, 0.0f);
Feb 28, 2008 at 3:25 PM
Edited Feb 28, 2008 at 3:26 PM
Hi, iam not sure but i think you have to write a new constraint. Calculate an impulse which zeros the z velocity and apply it. Direcly setting the position like you do is a hack.