Godot Version
4.3
Question
Hello,
I want to import an asset from blender which should be treated as a StaticBody3D.
The structure of the resulting scene should be something like this:
- root [StaticBody3D]
- my_mesh [MeshInstance3D]
- collision [CollisionShape3D]
However, whenever I use the “Generate Physics” option in the import menu or import a collider via the “-colonly” suffix, I get a Node3D for the root and a StaticBody3D child which is parent of a collision shape node:
- root [Node3D]
- my_mesh [MeshInstance3D]
- static_body [StaticBody3D
- collision [CollisionShape3D]
This is problematic because I want to have a root script which contains information about this specific asset and deals with physics interactions like incoming raycasts. However, raycasts can only return the hitting collider which is the StaticBody3D node. So in order to access the root script, I would have to call node.get_parent() one or more times (and generally I don’t know how often).
Therefore, my question is if there is an automatic way of importing static-bodies which result in the node structure described at the top. Or how would you deal with this problem?
PS: I know that I can change the root node type to StaticBody3D but this won’t give me a corresponding CollisionShape3D node which I would have to add manually.