Wake up object issue

Post Reply
maiklof
Posts: 19
Joined: Wed Nov 20, 2013 10:01 am

Wake up object issue

Post 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?
User avatar
drleviathan
Posts: 699
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Wake up object issue

Post 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.
Post Reply