kinematic and DISABLE_DEACTIVATION

gjaegy
Posts: 178
Joined: Fri Apr 18, 2008 2:20 pm

kinematic and DISABLE_DEACTIVATION

Post by gjaegy »

Hi guys.

I have a performance problem at the moment, due to the fact that all my kinematic objects (about 100) in my scene have the DISABLE_DEACTIVATION activation flag set.

I had a look through the forum, some old messages from Erwan recommend to use this flag for kinematic objects (as long as they are moving), while some newer ones are saying this flag shouldn't use as it's an internal flag.

Now, what's the best strategy to handle kinematic objects, which use motion states ?

- if nothings gets done, the rigid body are deactivated if not moving. When they start moving again, the rigid body transform is not updated anymore.
- if using the DISABLE_DEACTIVATION flag, performance drops considerably, as most of the kinematic objects are still, but still perform collision detection with terrain

I came up with the following solution: each frame, detect if the object has moved, in which case, call "m_pRigidBody->setActivationState(ACTIVE_TAG);" to wake it up.

Is there any other better option ? Couldn't Bullet handle this automatically ?
xexuxjy
Posts: 225
Joined: Wed Jan 07, 2009 11:43 am
Location: London

Re: kinematic and DISABLE_DEACTIVATION

Post by xexuxjy »

What I've done in the past is allow them to de-activate as normal, and in your MotionController have something to set them to active again when a new transform is set. (which is pretty much your solution)

Part of the problem with bullet doing this for you is that the whole idea of kinematic objects is kind of a bad fit as you're basically taking responsibility for moving the object yourself....
gjaegy
Posts: 178
Joined: Fri Apr 18, 2008 2:20 pm

Re: kinematic and DISABLE_DEACTIVATION

Post by gjaegy »

Thanks for your answer.

Yes, basically, this is more or less the same solution as the one I applied. The only difference comes from the fact that the position/orientation of the object come from an external simulator, and are constantly updated (even if not moving) - so I have no other choice than detecting the move/orientation delta manually, each frame.

So, I guess there is no better solution...