Rigidbody's deactivate when they should fall

Anubis
Posts: 2
Joined: Mon Mar 03, 2008 2:46 pm

Rigidbody's deactivate when they should fall

Post by Anubis »

Hi there,

Using bullet we came across a very annoying little bug. Everything works perfectly fine, but sometimes it happen that a rigidbody disables too quick and refuses to fall down.

The situation where it occurs is when we stack our objects so that when you shoot the first sideways away, a group of 10 objects will come crashing down. Now 9 out of 10 times this works flawlessly, but sometimes they just keep on standing still.
Which is very odd because we place the cubes so that they rest on each other, even on the object that is shot away. So they are touching but still they don't fall down.

For testing i have made that the objects light up when active and are dark when they are sleeping. When i shoot the object away i see that all the objects light up and then go dark again. I also noticed that sometimes they do move a tiny bit and then go to WANTS_DEACTIVATION and the next frame they are at ISLAND_SLEEPING and thus not moving anymore.

Ive also played around with deactivation time setting it higher, but that doesn't seem to affect them, and only when I set the linear and angular sleeping thresholds at really really low, they seem to don't do it anymore, but then they don't deactivate at all. So that isn't really a solution either.

Does anyone know how to solve this problem?

Thanks,


Thijs
mohican
Posts: 17
Joined: Mon Aug 25, 2008 5:12 pm

Re: Rigidbody's deactivate when they should fall

Post by mohican »

I have exactly the same issue in my application.
Is there any solution to this problem?
ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway

Re: Rigidbody's deactivate when they should fall

Post by ola »

You can set the sleeping threshold yourself, on the rigid bodies that sleep too soon. Use rigidbody->setSleepingThresholds(btScalar linear,btScalar angular). So each rigid body can have it's own settings.

The default values are 0.8 for linear velocities and 1.0 for angular velocities. You should try some lower values and see if that helps!

Best regards,
Ola
mohican
Posts: 17
Joined: Mon Aug 25, 2008 5:12 pm

Re: Rigidbody's deactivate when they should fall

Post by mohican »

Thanks for the Tip!

I have another related problem:
Say I have a stack of crates, and they all DEACTIVATE within a couple of seconds.
I then manually remove a bottom crate from the dynamic world with

Code: Select all

m_dynamicsWorld->removeRigidBody(&Bullet_Objects[id].rigidBody)

However, the crates above the one I just removed do not automatically REACTIVATE and they stay suspended in the air. Is there any way to get them to REACTIVATE automatically?

The only way to solve this problem I can think of atm is to use the contactManifold to manually reactivate all crates resting against the one I remove.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Rigidbody's deactivate when they should fall

Post by sparkprime »

I'm not sure but you could try activating the crate before removing it, activating it, waiting 1 frame, then removing it