Page 1 of 1

Wake up object issue

Posted: Tue Jun 08, 2021 10:06 am
by maiklof
Hi,
I am trying to avoid using DISABLE_DEACTIVATION flag and trying to find a more efficient way to handle objects that go to sleep being on top of another object. The object bellow is able to apply lateral friction using a customMaterialCallback (to simulate a conveyor) but when it stops, after a bit, the object above goes to sleep, as expected. Then, I cannot wake it up, even if I change the motion speed or try to activate the object state, because the customMaterialCallback is not executed anymore.
Any clever idea on how to awake this objects somehow else?

Re: Wake up object issue

Posted: Tue Jun 08, 2021 4:45 pm
by drleviathan
A simple way to contrive a conveyor is to make the object kinematic, give it a non-zero velocity, and then make its MotionState.getWorldTransform() always return the unchanging position. Dynamic bodies that touch the conveyor will pick up the non-zero velocity at all contact points and will slide along. As long as the conveyor's speed is larger than m_linearSleepingThreshold then neither dynamic bodies or the conveyor will be deactivated. If you stop the conveyor and things do go to sleep then when you wake the conveyor it should wake any touching dynamic objects.

In other words: maybe you don't need to override customMaterialCallback. Depends on if you're doing other fancy stuff therein.