Skip to content

Override mass properties for Area3D when using Jolt Physics #102029

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

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

mihe
Copy link
Contributor

@mihe mihe commented Jan 25, 2025

Fixes #101917.

Doing this resolves the assertion about "Invalid mass" when trying to use ConcavePolygonShape3D for an Area3D.

The reason for this assertion is that Area3D are implemented with what Jolt calls sensors, which are a type of body, and thus happen to have mass properties as well, which can't reasonably be calculated automatically for shapes like ConcavePolygonShape3D.

Note that concave shapes for an Area3D is problematic for a number of reasons, as mentioned in the documentation for Area3D, but it seems to work on some basic level at least, and seems to be about as janky in Godot Physics already, so I guess it's fine to just allow it for now.

@mihe mihe added this to the 4.4 milestone Jan 25, 2025
@mihe mihe requested a review from a team as a code owner January 25, 2025 17:11
@mihe mihe force-pushed the jolt/area-mass-properties branch from 3a4fef5 to f380b00 Compare January 25, 2025 17:15
@mihe mihe changed the title Add mass properties to Area3D when using Jolt Physics Override mass properties to Area3D when using Jolt Physics Jan 25, 2025
@mihe mihe changed the title Override mass properties to Area3D when using Jolt Physics Override mass properties for Area3D when using Jolt Physics Jan 25, 2025
Copy link
Member

@rburing rburing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

Should also be an optimization, if it really did the calculation even for sensors.

@Repiteo Repiteo merged commit b7deb85 into godotengine:master Jan 28, 2025
19 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Jan 28, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid mass error when using a ConcavePolygonShape3D as the collision for a Area3D in Jolt Physics
3 participants