Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SoftBodyManifold now returns sensor contacts separately #1276

Merged
merged 14 commits into from
Sep 22, 2024

Conversation

jrouwe
Copy link
Owner

@jrouwe jrouwe commented Sep 22, 2024

Before this change, there wasa limit of a single colliding body per soft body vertex. If the closest body happened to be a sensor this effectively disabled the collision with the world and caused artifacts. We can now also detect multiple sensor contacts per soft body.

Fixes #1016

Copy link

@mihe
Copy link
Contributor

mihe commented Sep 22, 2024

Any quirks or gotchas with this? It sounded like it was challenging to come up with a performant implementation for it.

@jrouwe
Copy link
Owner Author

jrouwe commented Sep 22, 2024

Well the implementation is not as 'parallel' as I'd like it to be, but I think I found something that doesn't perform too badly.

It differs from godot in the sense that it does vertex level collision detection between the soft body and the sensor, where godot only seems to check if the aabb's overlap (I can make a mode for that if needed).

I'm currently trying to hook it up in godot-jolt to see if I left anything out of the API (I'm suspecting you may need a contact point/normal which I'm currently not exposing).

@mihe
Copy link
Contributor

mihe commented Sep 22, 2024

Well the implementation is not as 'parallel' as I'd like it to be, but I think I found something that doesn't perform too badly.

Cool!

It differs from godot in the sense that it does vertex level collision detection between the soft body and the sensor, where godot only seems to check if the aabb's overlap (I can make a mode for that if needed).

I struggle to see the AABB mode being a desirable behavior, but then I've said that about other things that later have turned out to be a problem.

I'm currently trying to hook it up in godot-jolt to see if I left anything out of the API (I'm suspecting you may need a contact point/normal which I'm currently not exposing).

I'd be happy to give this a try myself, if you want. The code surrounding all the area contacts/overlap stuff is a bit rough. I'm not sure if it'll cleanly interface with soft bodies at the moment.

@jrouwe
Copy link
Owner Author

jrouwe commented Sep 22, 2024

I'd be happy to give this a try myself, if you want. The code surrounding all the area contacts/overlap stuff is a bit rough. I'm not sure if it'll cleanly interface with soft bodies at the moment.

That may be a good idea. I got to the point where the area triggers an enter callback for the soft body (but no exit callback), so I think the Jolt API is working. The main problem seems to be that a body inherits from JoltShapedObjectImpl3D while a soft body inherits from JoltObjectImpl3D. There are various places where the code silently returns because it fails to cast to a JoltShapedObjectImpl3D and some of the area implementation is implemented at JoltBodyImpl3D level.

My test scene: soft-body-cloth.zip

My branch: https://github.com/jrouwe/godot-jolt/tree/area_vs_soft_body

@jrouwe jrouwe merged commit 4058e6a into master Sep 22, 2024
69 checks passed
@jrouwe jrouwe deleted the feature/sb_multi_contact branch September 22, 2024 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support multiple collisions per vertex for a soft body
2 participants