Godot Version
4.1.1
Question
I recently imported my Blender project across into Godot and the object mesh for the top floor of my building is a ‘MeshInstance3D’ in Godot which I have then added a ‘StaticBody3D’ and ‘CollisionShape3D’ to as child nodes.
Having decided to read up more about how to create this node setup manually in Godot to create a floor, the tutorial I am following explained that the first parent node to be created should be a ‘StaticBody3D’ which then has a ‘Meshinstance3D’ and a ‘Collisionshape3D’ has child nodes.
So my question is does it matter which out of these 3 nodes are primary or child nodes in order to create a visible floor with physics?
The CollisionShape3D
has to be a child of the StaticBody3D
for the body to have collision. If you don’t have a collision shape as a child you’ll get a “Node Configuration Warning!”.
This node has no shape, so it can’t collide or interact with other objects.
Consider adding a CollisionShape3D or a CollisionPolygon3D as a child to define its shape.
In this case the MeshInstance3D
can either be a child of the StaticBody3D
or its parent. However, in general I’d make the Mesh a child.
The reason it can be either is because static bodies don’t move, so it doesn’t matter which is the parent. If you had rigid bodies that could move having the mesh as a child keeps the visual meshes location in sync with the physics location. If the mesh was the parent it wouldn’t automatically update when the physics node moved.
4 Likes
Thanks for the clarification.
I will bear this in mind. I am personally tempted to use the MeshInstance3D has the parent node I guess in my mind you need to be working with something visible (the baked mesh image) to then extrapolate a collision area from its dimensions.
Something about the heiarchy in Godot. Godot processes the scene rendering from top down. Top of list going down. What is listed at top will be rendered first. It can be important to know for the GUI.
2 Likes