godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.15k stars 21.18k forks source link

SoftBody pinned point indices not corresponding to mesh vertices due to removal of duplicate mesh vertices #26611

Open and3rson opened 5 years ago

and3rson commented 5 years ago

Godot version: v3.1-beta10

OS/device including version: ArchLinux rolling

Issue description: SoftBody pinned_points are out of sync with ArrayMesh vertexes because duplicate vertices are removed on physics server.

This is because in modules/bullet/soft_body_bullet.cpp:322, in SoftBodyBullet::set_trimesh_body_shape method, duplicate points are removed, thus making mesh indices out of sync with the indexes that pinned points store. Took me forever to find it.

This makes setting pinned_points a real pain in the ass because you first need to remove duplicate vertices from mesh and then calculate new index of the vertex.

This really should be documented somewhere. OR vs_indices_to_physics_table could be exposed to allow user to resolve soft body vertex index on physics server by specifying vertex index taken from ArrayMesh.

Summoning @AndreaCatania :)

KoBeWi commented 3 years ago

Can anyone still reproduce this bug in Godot 3.2.3 or any later release?

If yes, please ensure that an up-to-date Minimal Reproduction Project (MRP) is included in this report (a MRP is a zipped Godot project with the minimal elements necessary to reliably trigger the bug). You can upload ZIP files in an issue comment with a drag and drop.