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

Add Mesh.create_convex_shapes() to expose convex decomposition for scripts #93625

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

smix8
Copy link
Contributor

@smix8 smix8 commented Jun 26, 2024

Adds Mesh.create_convex_shapes() functions so scripts can make use of the convex decomposition with MeshConvexDecompositionSettings parameters.

Usage example:

var torus: TorusMesh = TorusMesh.new()
var settings: MeshConvexDecompositionSettings = MeshConvexDecompositionSettings.new()
settings.max_convex_hulls = 10
settings.max_concavity = 0.001
var convex_shapes: Array = torus.create_convex_shapes(settings)
print(convex_shapes)

In the past due to all the other engine functions using types that do not work with script bindings the only function exposed for scripting that could work with the MeshConvexDecompositionSettings parameters was the MeshInstance3D.create_multiple_convex_collisions(settings) function changed/added by #72152.

That MeshInstance3D function always had the down-side of being an extra node and also creating new StaticBody3D and CollisionShape3D nodes for compatibility instead of just the collision shapes. This caused a number of frequent complains from users that needed convex decomposition of meshes for procedural stuff but were only interested in the resulting shapes, not all the performance costing unneeded extras.

@smix8 smix8 added this to the 4.4 milestone Jun 26, 2024
@smix8 smix8 requested a review from a team as a code owner June 26, 2024 09:51
@smix8 smix8 requested review from a team June 26, 2024 11:17
…ripts

Adds Mesh.create_convex_shapes() functions so scripts can make use of the convex decomposition with MeshConvexDecompositionSettings parameters.
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.

2 participants