jrouwe / JoltPhysics

A multi core friendly rigid body physics and collision detection library. Written in C++. Suitable for games and VR applications. Used by Horizon Forbidden West.
MIT License
6.72k stars 447 forks source link

Soft bodies don't seem to work with scaled compound shapes #895

Closed mihe closed 9 months ago

mihe commented 9 months ago

This is a strange issue that I haven't been able to reproduce with just a simple scaled shape, but I have a snapshot that should hopefully suffice: jolt_snapshot_2024-02-02_21-18-30_63008.zip

The scene structure is essentially this:

If you add any soft body to LoadSnapshotTest::Initialize, like this one:

mBodyInterface->CreateAndAddSoftBody(SoftBodyCreationSettings(SoftBodyCreator::CreateCube(), RVec3(0.0f, 10.0f, 0.0f), Quat::sIdentity(), Layers::MOVING), EActivation::Activate);

You should see something like this:

https://github.com/jrouwe/JoltPhysics/assets/4884246/f215a02a-e3fa-4e0e-a8b9-946a20886e30

jrouwe commented 9 months ago

Thanks for the good repro! It failed to properly take the center of mass into account.