Havok - wake up from sleep mode

Hello everybody,

I continue my merry way in Havok and its motorized constraints. I just noticed that an unused motor whose bodies are not moving enters into sleep mode quickly (about 250ms).

I made a small example that shows this. Depending on when the timer is triggered, the motor is running or not. Change the timer to 2000 at line 80 to reproduce the issue.

I couldn’t find an API function to explicitly wake the bodies attached to the constraint. The only reference to sleep mode appears in the constructor of PhysicsBody, at the time of its initialization, but this is not sufficient in my case.
Moreover, in the V1 physics engine, there was the PhysicsPlugin.wakeUpBody() function to do this.

Does anyone know how to wake up a body?

Thanks in advance!

Hello!

We can’t manually wake up a body as that’s supposed to be controlled by the physics engine only, but it’s weird the motor is not moving :thinking: @eoin do you have an idea of what’s going on?

@eoin Any news about this? I’m very stuck with this issue.

You can wake up the body by applying a force or impulse(can be zero as well, as the function itself wakes up the body it seems)

2 Likes

Thank you very much, I confirm that this workaround wakes up the bodies.

function wakeUpBody(body) {
  body.applyForce(new Vector3(0, 0, 0), body.transformNode.position)
}

I can go on with this for now, but a cleaner way to wake up a body would be welcome.

Oh sorry! I totally missed this last week; was pulled into some projects which took a bunch of my time. The upcoming version of the WASM will have additional functions for sleep control, but looks like you’ve found a bug; changing some of the constraint params don’t send an activation request to the attached bodies. I’ll be sure to get this fixed up too, but Raggar’s workaround should hold you over 'til then. Thanks Raggar!

2 Likes

Thank you, I will monitor the introduction of this feature :slight_smile: