Objects slowing down for no reason in zero gravity

Cetra
Posts: 8
Joined: Fri Dec 17, 2010 3:24 am

Objects slowing down for no reason in zero gravity

Post by Cetra »

Hi all,

I'm having a few issues with objects in zero gravity. They seem to be slowing down for whatever reason and I can't seem to find a reason why.

I have some Rigid Bodies flying around a map. They are constrained to operate in only 2 dimensions and rotate about their Z axis (setLinearFactor(btVector3(1,1,0));setAngularFactor(btVector3(0,0,1)))

I have also turned off damping (setDamping(0,0)) and jacked up restitution (setRestitution(1))

If I set them to have zero linear velocity, but an angular velocity i.e:

RigidBody->setLinearVelocity(btVector3(0,0,0));
RigidBody->setAngularVelocity(btVector3(0,0,1));

Eventually the body will come to a complete stop.
Here's an example output:

Code: Select all

LVelocity: x0.000000 y0.000000 z0.000000 - AVelocity: x0.000000 y0.000000 z0.799493
LVelocity: x0.000000 y0.000000 z0.000000 - AVelocity: x0.000000 y0.000000 z0.799493
<omitted but you get the idea>
LVelocity: x0.000000 y0.000000 z0.000000 - AVelocity: x0.000000 y0.000000 z0.799493
LVelocity: x0.000000 y0.000000 z0.000000 - AVelocity: x0.000000 y0.000000 z0.799493
LVelocity: x0.000000 y0.000000 z0.000000 - AVelocity: x0.000000 y0.000000 z0.000000 <------
LVelocity: x0.000000 y0.000000 z0.000000 - AVelocity: x0.000000 y0.000000 z0.000000
LVelocity: x0.000000 y0.000000 z0.000000 - AVelocity: x0.000000 y0.000000 z0.000000
I'm not sure why this happens.

The other thing I'm having an issue with is that I have a few walls that are immovable (mass set to 0) and they seem to rob them of any momentum they had after time. I have set the restitution to 1 but that doesn't seem to make the objects bounce off with the same amount of energy they started with.

Any ideas?
Domi
Posts: 4
Joined: Fri Apr 06, 2012 2:10 am

Re: Objects slowing down for no reason in zero gravity

Post by Domi »

Total restitution of an impact is computed by considering that of both objects. If both objects have restitution = 1, the normal outgoing speed should be 100% of the incoming speed. The tangential speed is dampened by dynamic friction, so you might also want to look into that, depending on the angle of impact.

Make sure that you did not overlook other damping parameters that slow down movement mid-air, and during collisions.

If you rob them of one dimension, they would obviously lose 100% of all the kinetic energy that would move them within that dimension. In order to find out what's wrong, you can first try to reset the z-dimension factors to 1 and see if they get any movement in that direction at the point where you see them stop or lose speed.
marios
Posts: 52
Joined: Mon Jul 19, 2010 3:11 am

Re: Objects slowing down for no reason in zero gravity

Post by marios »

maybe it's object deactivvation (sleeping)
try

Code: Select all

body->setActivationState(DISABLE_DEACTIVATION);
when creating objects