Havok - wake up from sleep mode

That’s right; we have exposed a bunch of functions in the WASM for sleep control (we call it activation/deactivation, rather than sleeping):

    /** Try to set the activation state of a body. */
    HP_Body_SetActivationState(bodyId: HP_BodyId, activationState: ActivationState): Result;
    /** Get the current activation state of a body. */
    HP_Body_GetActivationState(bodyId: HP_BodyId): [Result, ActivationState];
    /** Set the activation behavior of a body. See `ActivationControl` for more details. */
    HP_Body_SetActivationControl(bodyId: HP_BodyId, activationControl: ActivationControl): Result;
    /** Set the activation priority of a body. `priority` should be in the range [-127, 127]. Defaults to 0.
     * A body with simulation controlled activation will only be activated by interactions from other bodies
     * whose priority is >= `priority` */
    HP_Body_SetActivationPriority(bodyId: HP_BodyId, priority: number): Result;

These just need to be exposed in the HavokPlugin. The last two methods do offer more control than other physics engines do, though, so need to be careful we’re not adding an interface which doesn’t make sense for those potential other engines.

(Also, the havok package v1.3.0 fixed the reporter’s bug where changing the constraint parameters didn’t activate attached bodies)

1 Like