![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Thorsten |
Hey guys,
I’d like to dynamically add some simple Meshes (blocks) to a RigidBody. Tried several things and ended up with:
- adding a Meshinstance
- adding an appropriate CollisionShape
Looks good in the first place, collisions work and it looks correct, BUT it seems that all new elements do not have any weight. So gravity only works on the initial mesh.
Any hints?
Best
Thorsten
Physics/gravity acts on the body, not the meshes. It sounds like maybe you’re not adding the meshes as children of the body? Show your code where you’re doing this.
kidscancode | 2021-05-16 18:39
Hi there,
I just tried in the Editor (added meshes and collision shapes). Only the first shape/mesh added seems to have weight.
However - I’m missing add_shape (Godot 2) as method for RigidBody. How would I have to do it now?
Thorsten | 2021-05-16 20:02
You need to show what you’re doing then. Because again, a mesh can’t have weight. Only the rigid body has physics properties. Meshes should be attached to it to give it visible components.
kidscancode | 2021-05-16 20:17
http://polyaktiv.de/godot_rigid_body2.png
This is what I tried in the editor (Scene tree), and yes, MeshInstances and CollisionShapes do match
http://polyaktiv.de/godot_rigid_body.png
The RigidBody with all elements falls correctly and the collisions work, a but in the end everything behaves as if only the first box has weight. You can add as many boxes to the side, the body will never fall over. That’s weird, isn’t it?
Thanks for your support. Love your tutorials!
Thorsten | 2021-05-16 21:32