General design question - game mechanics for a spaceship

Godot Version

Godot 4.0

Question

I am making a game with a spaceship in 3d. You control the ship by turning on and off individual engines. If you turn on right engine the ship turns left and vice versa. Turning on both engines makes the ship go straight ahead.

Alt A: Sounds simple enough and I have a working prototype that uses rigidbody3d for the engines and the ship, I use joints for connecting them together. I add forces to the engines and they push the spaceship.

This is not working so great, it is wiggly and janky, the engines move in weird angles.

Alt B: So I tried making the engines characterbodies instead, just adding variables and engine positions from center to them so that the main ship can use to apply the correct forces to the ship.

This also kind of worked but I lost the turning functionality and had to calculate and apply torque to make the ship turn. I also got a problem where the ship turns a little at first but then suddenly turns exponential.

Alt C: The third thing that I am trying now is to use character body for the ship and not use forces at all. I think this is the way to go since I really don’t actually need physics. And it will make online multiplayer easier to implement.

My question is:

  1. How would someone with more experience of godot design this mechanic? A, B, C or perhaps a whole other approach.

  2. If I am going with alternative 3 how woud I calculate the combined forces of the engines and apply them to the characterbody3d(Ship)

To clarify I am not looking for someone to give me code, I am prepared to figure it out for myself but I need some direction to avoid wasting to much time this early in the project.

Best regards Michael

Hi Michael.
I’m not a Godot expert, but I usually take simple approaches, in implementing my ideas.
So, what comes to mind is, giving the ship (a) direction, (b) speed, and applying inertia, along with yaw left ↔ yaw right controls.

That’s in my head, but shouldn’t be difficult to code.
I know you said you don’t want code, but this is just to give an idea.
Five Ways to Code Movement

There probably are many others like this, out there.
I know you are eager to get going, so just offering my two cents.
Hope it helps. :smile:

1 Like