I have an empty game object that I consider the root object for a bunch of prefab cubes of type, Regular, Weapon, and Movement.
Block Types:
Regular: provides structure and a place for other nodes to attach.
Weapon: attaches to Regular nodes and can shoot.
Movement: provides thrust in a desired direction.
Block Prefab Contents:
Blocks consist of: Script for controlling that type of block, a 1x1x1 cube primitive, rigid body with gravity enabled and a mass of 1, cube collider.
So with these block types you create a vehicle. Adding them all to ‘root’ empty game object node.
On your movement function you apply force to your engines and that is when it all breaks down.
I want to move all the cubes as one unit. I figured one way is to add fixed joints to each of the nodes and add it’s adjacent node. This worked alright except there was some noticeable jiggle if I messed up thrust and the ship toppled over. It didn’t look ‘glued’ together. How do I make these blocks stick to each other while manipulating the ‘thrust’ from my engines and make the entire ship behave as a single unit.
Edit:
So one possible solution is to remove the rigid bodies from all the individual blocks, add one to the root gameobject that everything is a child of and add force to that. It will work well enough but what are the options for an entire physics based vehicle that is created from modular parts?