2D game

Mar 24, 2010 at 11:56 PM


I'm developping a 3D game, but with a 2 dimensions gameplay (like Little Big Planet).

So what is the best way to force my model to stay in two axis only ?

I look at for the constraint but don't have a good result for my problem.

thanks for your help and for this great physic engine.


Mar 27, 2010 at 5:03 AM
Edited Mar 27, 2010 at 5:04 AM

Hi khemri,

Well, the best way to accomplish this is probably with constraints.  You would need a constraint that limits movement on the Z axis (PointToPointConstraint limits movement to all three axes) and, possibly, a constraint that limits rotation to just the Z axis (The HingeConstraint sort of does this) if that's what you want.  You could probably figure out both of these by basing these new constraints on the existing PointToPointConstraint and HingContraint. 

You can also try one or a mixture of a few of the following though I don't have high confidence that this will be as successful as constraints:

- set RigidBody.Veleocity.Z to zero before integration.

- Set RigidBody.Position.Z to the same value after integration.

- Modify the collision normals before resolution so it is normalized to just the X and Y components and set the Z to zero.

- Set the RigidBody.Rotation.X and Y to zero before integration.

- Put up two CollisionPlanes as "walls" to keep all you rigid bodies near the same plane.

Good luck!  Let me know if you have any questions.

Apr 3, 2010 at 12:00 AM

thank you for your fast help,

i will try it and let you know my result.