Skip to content

Rigid body moving while sleeping #688

@Morten-Hilker-Skaaning

Description

@Morten-Hilker-Skaaning

Dear PhysX crew,

I'm trying to get a rigid body to float using simulated buoyancy. PhysX 5.6.1.
This is done using PxRigidBody::addForce() and addTorque(). It works fine and the buoyant forces can counteract gravity so my rigid body can come to rest.

So I want to implement sleeping support for the rigid bodies, while they're being lifted by the buoyancy force. This is for performance reasons in larger levels.

I make a "shouldSleep()" function, similar to DySleep.cpp's updateWakeCounter(). When I determine a rigid body should sleep, I call PxRigidDynamic::putToSleep().

My problem comes when I attach a mouse drag constraint (PxSphericalJoint). When I call putToSleep() on the rigid body with an active constraint, the rigid body never wakes up again, but it's moved around by the solver and its wakeCounter is non-zero.

I'd expect the rigid body would wake up if it was moved by the solver.

When the wakeCounter is set by the solverWakeCounter, the body ends up in ScAfterIntegrationTask's activateBodies. The call to SimpleIslandManager::activateNode() is done, but isActiveOrActivating() is false, so the node is never added to the active / activating nodes. I feel the body should have woken up.

I've attached a video recording and a PVD capture (two different runs). In the video the magenta outline is the PhysX's own debug visualization. You can also see the de-sync between the shape and the body in the PVD capture.

buoyancy_sleepwalking.mp4

buoyancy_sleepwalking_pvd.zip

Kind Regards,
Morten Hilker-Skaaning

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions