godotengine / godot

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

Losing transformation of CollisionShapes when creating a mesh library with "Import from scene" #45694

Closed revilo closed 3 years ago

revilo commented 3 years ago

Godot version: 3.2.4.beta6 3.2.4.rc1

OS/device including version: Ubuntu Linux 20.04 / GLES3 renderer

Issue description: When filling a meshlib using the "Import from Scene" command from the "Mesh Library" editor menu, the collision shapes' transformation is not respected. The resulting shapes attached to the items in the meshlib are snapped back to the origin. This issue does not happen when doing it from the scene by using the "Convert to... Mesh Library" function.

Example screenshot with a mesh that uses a CollisionShape of type "BoxShape" moved up to position [0,2,0] using both methods: 03_gridmaps_comparison_3 2 4 rc1

Steps to reproduce:

  1. Create a scene to be used as a source for the meshlib: 00_meshlib_source-scene-setup
  2. MeshInstance.Mesh -> New CubeMesh (with default dimensions)
  3. CollisionShape.Shape -> New BoxShape (with default dimensions)
  4. Set CollisionShape.Transform.Translation to [x=0, y=2; z=0]
  5. Save scene
  6. Create meshlib
  7. Invoke "Mesh Library -> Import from Scene" on new meshlib, and select previously saved scene

When using the meshlib in a gridmap, you'll notice that the CollisionShape of the mesh snapped back to [0,0,0], and thus not respecting the transformation from the original scene file.

Expectation: The CollisionShape of the mesh should be at [0,2,0]

Minimal reproduction project: sample_project_3.2.4.rc1.zip

I hope I could make clear what the issue is. The problem does not occur in 3.2.4.beta4 + 3.2.4.beta5.

Calinou commented 3 years ago

For reference, here's the list of commits between 3.2.4beta5 and 3.2.4beta6.