Building City for Hole

Godot Version

4.7.2

Question

As standard I have tried Kaykit City Builder Bits.

But when it’s used for RigidBody3D it’s not playing nice, should use StaticBody3D for those building and force falling via code?

I putted 500kg - 1000kg on those buildings, Hole got 50kg.

The test in the game it looks terrible →

GitHub - artemisiagodot-beep/hole_godot_stencil · GitHub - updated

Things that don’t fit through the hole shouldn’t be rigid bodies.
If the hole gets bigger as you progress, you should turn new things into rigid bodies with each hole enlargement.

You mean keep them freeze = true or node type change during runtime?

Whichever works best for you.

I know how to turn off mask, or unfreeze/freeze.

Changing the node_type is bit like witchcraft as not sure if I don’t need to do some .duplicate() or .new() to make it works.

Use freeze then.

With the other approach, you don’t really need to change any node types as such. Just unparent the rigid body parts from the object scene (but keep a reference to them). The object will then only serve as a visual representation, i.e. it will only have a mesh node. When the time comes, reparent the rigid body back in.

I’m a bit lost here.

RigidBody3D is main node, below got MeshInstance and CollisionShape nodes.

How could I achieve what you described?

Remember that at runtime, the whole scene tree is just one big tree of nodes. You can at any time rearrange it any way you see fit.

Get rigid body’s parent. Reparent the mesh node to this parent, unparent the rigid body node and store its reference in mesh node’s metadata (or in some dedicated dictionary)

To reverse it, get mesh’s parent, get rigid body reference from mesh’s metadata, parent the rigid body to mesh’s parent and reparent the mesh to rigid body.

Note though that in your case for now, just freezing the body would likely be enough. Juggling nodes in this way would only make sense if you want to minimize the number of computationally heavy nodes (like rigid bodies) or nodes in general, as an optimization strategy.