Questions about constraints

jduran
Posts: 11
Joined: Sat Aug 13, 2011 2:55 pm

Questions about constraints

Post by jduran »

Dear all,

I'm developing a game based on AR. With the marker, a maze is moved to control a ball. The ball should be moved based on the physics so there is no problem. The problem comes with the exit door. The exit door should be always at the same position respect to the maze. My idea is use a constraint to this the position of the exit door respect to the maze.

The I've questions about constraints:
- Is it possible to attach a static body to a constraint?
- At which point of the object is attached the constraint? at the center of masses? at a specific point?
- Does the constraints could be configured to behave as rigid wires?

Thanks and Best Regards,
Joaquim Duran
Mako_energy02
Posts: 171
Joined: Sun Jan 17, 2010 4:47 am

Re: Questions about constraints

Post by Mako_energy02 »

1) Yes, it is possible to use a static body with a constraint. For the most part you should use rigid bodies with constraints, although there are constraints on the soft body class you can use with them. Otherwise type of body based on flags(static, kinematic, etc.) doesn't matter as much.
2) When constructing the constraint(except for the point2point constraint, which is just a vector3) you have to pass in a btTransform(which is a location and a rotation). The location portion of the transform you pass in is the point in local space where the constrain will act on that particular body.
3) Constraints could be programmed to behave like rigid wires, yes. Best bet here would be the point2point constraint or the generic6dof constraint. Just for further clarification, you won't be able to do any kind of soft wire/rope this way, soft bodies are better for that. You could however chain link a bunch of bodies together using constraints to make it look somewhat like a rope, but then you may have some errors in the simulation since constraints aren't meant to be stacked several times, although a little bit of stacking is fine.
jduran
Posts: 11
Joined: Sat Aug 13, 2011 2:55 pm

Re: Questions about constraints

Post by jduran »

Many thanks for your answer, It's has been very helpfull.

Joaquim Duran