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

Soft body does nothing if it's Mesh is array mesh programmatically created with SurfaceTool #91690

Closed
rasikrodri opened this issue May 8, 2024 · 4 comments · Fixed by #91896

Comments

@rasikrodri
Copy link

Tested versions

A soft body with a procedurally generated mesh does not do anything. When you run the game the mesh just appears at coordinates 0,0,0,

image

System information

Windows 10 - Godot 4.2.2 stable

Issue description

E 0:00:00:0471 create_from_trimesh: Condition "p_indices.is_empty()" is true. Returning: false
<C++ Source> servers/physics_3d/godot_soft_body_3d.cpp:469 @ create_from_trimesh()

Steps to reproduce

-Just run the scene and you will see that the volleyball net is static at 0,0,0 coordinates, that's it. Also there is an error in the console:

Minimal reproduction project (MRP)

ProceduralSoftBodyBug.zip

@clayjohn
Copy link
Member

clayjohn commented May 8, 2024

The error leads me to think that the mesh needs to have indices. Can you try adding indices to the mesh when you create it? You can do that using surface_tool.index() before committing the mesh to an ArrayMesh

@rasikrodri
Copy link
Author

rasikrodri commented May 8, 2024 via email

@clayjohn
Copy link
Member

clayjohn commented May 8, 2024

Thanks for checking!

We should add a clear error message to the set_mesh() function so it can error out early and give users useful feedback. The error can be added here:

Array arrays = RenderingServer::get_singleton()->mesh_surface_get_arrays(soft_mesh, 0);
ERR_FAIL_COND(arrays.is_empty());
bool success = create_from_trimesh(arrays[RenderingServer::ARRAY_INDEX], arrays[RenderingServer::ARRAY_VERTEX]);

@rrodriguez-medicaljustice

Thank you again!

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

Successfully merging a pull request may close this issue.

5 participants