Help: Instability with chained constraints

nullObjectPntr
Posts: 1
Joined: Fri Mar 04, 2011 6:36 pm

Help: Instability with chained constraints

Post by nullObjectPntr »

I'm working on a game for the iPhone with the Oolong Engine and the latest stable version of the Bullet SDK.

The game I'm making is basically a re-boot of Rocket Jockey, and the constraint I need is basically a grappling hook. Rather than take 200 words to describe it - you can get the best feel for it by skipping to the middle of this video of gameplay from rocket jockey: http://www.youtube.com/watch?v=wL8AnmZg ... re=related

This is trickier than it looks - a simple hinge or P2P constraint wont work - the rocket needs to be able to "steer" a slight deviation from the tangent of its circular motion around the thing its grappled to. Say for example, a cone of 20 degrees deviation from the tangent. So - as far as I'm concerned - I need to link a few constraints together to get this effect.

So the way I've tried to model this is like so:

The rocket is a rigid body with a heavy mass (100) and a small amount of linear and angular damping. Attached to either side of the rocket is another rigid body with a mass 1/100th of the rocket- think of this conceptually as the place where the grappling hook shoots out of.

The two are attached together using a P2P constraint so that the rocket can freely pivot around the other body (for the time being I am ignoring the restriction that the rocket can only deviate 20 degrees about the tangent)

To the smaller mass (the grapple hook deployment position) I attach another P2P constraint to the pylon - so the hook position should be able to orbit around the pylon.

My thinking here is that the rocket should pull on the hook position - the hook position - on the pylon - and the rocket should orbit the pylon and be able to steer it a bit. But when I run the simulation - I can see the hook position "fight" to solve the constraint and it jerks back and forth between the pylon and the rocket - all the while adding energy to the simulation. Eventually my rocket starts to "teleport" to area's of the level as the instability just keeps increasing.

Changing the mass ratio of the rocket and its grapple deployment position can make it more or less stable - but nothing really fixes the problem. I've also tried different pairs (1 hinge, and 1 P2P), (2 hinge), (1 P2P, 1 6DOF) etc etc but they all seem to suffer from the same problem.

What constraint solver is used under the hood? I'm somewhat familiar with the Constrained Dynamics course notes from siggraph by BW - so shouldn't the Lagrangian mechanics NOT add energy into the system?

I've been at this for weeks, really struggling with it. ANY help at all would really be appreciated. I'm even ready to write my own spring constraint, if someone can give me tips on how to integrate it with Bullet system.

Thanks, if I ever finish this game you'll be sure to get a mention in the credits : )

-Jonathan
xiaoQ0903
Posts: 10
Joined: Thu Jan 13, 2011 12:42 pm

Re: Help: Instability with chained constraints

Post by xiaoQ0903 »

nullObjectPntr wrote: I've been at this for weeks, really struggling with it. ANY help at all would really be appreciated. I'm even ready to write my own spring constraint, if someone can give me tips on how to integrate it with Bullet system.
Hi Jonathan!
I am willing to do some similar work to improve the performance of the constraint, Have you implemented your work?