Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | VonMoustachen |
Hi,
I am currently trying to build a robocraft-like game (is about building a vehicle using cubes, weapons, wheels, thrusters… ) and I got incredibly stuck.
Let me explain:
I have a scene “cube”, with a script attached that controls health and other events.
The cube root node is a rigid body with a box collision shape and a meshinstance loaded from a .obj
Now I define a main scene with a spatial node called “Vehicle”, which has two childs:
- a spatial “orbital_camera” node for a camera that orbits the vehicle (works ok)
- a spatial node called “VehicleBody” which holds all the vehicle geometry.
The scene also has a static body called “Map”, that consists in a flattened box acting as ground.
Question A:
If I instance some “cube” scenes as child of VehicleBody, they physically behave like completely separated objects, despite being on the same node. What am I missing here?
Question B:
If I change the node type of “VehicleBody” to rigid body, cubes seem to be locked in place between each other (good thing), but they will not collide with anything (bad thing) or interact physically. I understand that this is due to their global position being attached to a rigid body without collision shape?
Question C:
If I change de node type of “VehicleBody” to rigid body, and by gdscript I attach the collision mesh and visual mesh, it collides and cubes stay together. But then I lose the capability for each cube tracking their own things without any other external control. Also, they have no weight and the vehicle moves weird. This implementation could work by applying a gravity force on each cube at every physics step, checking the state of every cube in a global list, handling block removal by the parent node… I find this way of proceeding nonsensical and perfomance killing in comparison with the idea of scene instancing and keeping everything as loosely tied as possible. Is this the only way possible?
After reading all the painfully sparse documentation, examples, qa and everything, I think I am missing something big here, but I just can’t figure out.
Thank you.
Javier.