godotengine / godot

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

Meshlibrary not saving CollisionShape3D when exported #77121

Closed Khailz closed 1 year ago

Khailz commented 1 year ago

Godot version

4.0.2.stable

System information

Arch Linux, AMD 3900X, AMD Radeon RX 570

Issue description

I have created a mesh scene called "cube" with nodes as follows:

After saving the "cube" scene, I converted it into a MeshLibrary and imported that MeshLibrary into a GridMap scene.

The issue is that collision detection does not work for the imported MeshInstance3D objects into the GridMap scene. Collisions are only detected if I manually go to the GridMap scene, click on the MeshLibrary, go to the MeshInstance3D node, and re-add a BoxShape3D to the shapes array.

Or

Go to the MeshLibrary itself and add the BoxShape to it if it is missing.

Steps to reproduce

  1. Create a "cube" scene with the following node structure:

    • StaticBody3D (root node)
      • MeshInstance3D
      • CollisionShape3D
  2. Save the "cube" scene.

4.0 Convert the "cube" scene to a MeshLibrary.

4.0.1 Import the MeshLibrary into a GridMap scene.

4.0.2 Instantiate a mesh object from the MeshLibrary in the GridMap scene.

4.0.3 Test collision detection with the instantiated object in the GridMap scene.

or

4.1 Open the MeshLibrary directly and look for the shapes in the inspector.

Minimal reproduction project

N/A

smix8 commented 1 year ago

See MeshLibrary and GridMap documentation that you can find here.

The MeshLibrary scene export expects the StaticBody3D nodes to be a direct child of the MeshInstance3D. Same with NavigationRegion3D in case you want to scene export NavigationMeshes as well.

Khailz commented 1 year ago

Cool, thanks, this worked out. Funnily enough I was already looking at the linked doc before coming back here to close the issue. Was following a slightly old post about this and it didn't mention the static body being the child of the mesh instead.

Closing the issue. Thanks for the help.