problems with a simple spring-damping sytem

suitx
Posts: 4
Joined: Wed Jan 28, 2009 10:00 am

problems with a simple spring-damping sytem

Post by suitx »

Hi,

I have implemented my own simple spring-damping system. For that I calculate forces and apply them to my rigid body.

There are nine boxes. A big one in the worlds center is the "passive" Box. On each of it's edges a smaller box is connected via a spring-damping system.
The big box in the middle of the scene should stay in the center of the eight smaller boxes. For translation this holds true.
When i start moving one of the small boxes with the mouse it starts spinning. That shouldn't happen since each corner is pulled towards one small box.
Seems if the applied force in "btRigidBody::applyForce(btVetor3 force, btVector3 rel_pos);" doesn't correctly act on the relative pos of the big box.

Please take a look at the attached sample code.
The important functions are:

Code: Select all

void	calculateAndApplyForces(float dt);
void	applyForce(btRigidBody* bodyActive, btRigidBody* bodyPassive, btVector3& relPos);
Has anyone any clue how to get the big box averaged in the center of the eight small boxes without spinning around?

Best reagrds,

Jan
You do not have the required permissions to view the files attached to this post.
suitx
Posts: 4
Joined: Wed Jan 28, 2009 10:00 am

Re: problems with a simple spring-damping sytem

Post by suitx »

Hi again, I've uploaded the compiled demo for the code above. So you can easily check the strange behaviour. It is compiled against Bullet-2.75-beta1.

http://www.janjacobs.de/files/bullet/sp ... p_demo.zip

I also tried somthing similar with the PhysX engine. There it behaves like desired. But I really prefer bullet over PhysX and want to fix it there.

So what am I missing? Or do you have any hint how to achieve this setup with internal btJoint's?