0

I am working on a small game and i have run into one fundamental problem, when multiple forces act on an object what is the best formula to use in order to calculate the resulting direction and power?

I know that this can be calculated by drawing paralellograms but this doe s not really help when coding an algorithm for it, i am mostly looking for a formula but if you want to know i am writing the code in GDscript.

Partin22
  • 13
  • 3
  • 5
  • 3
    This is vector addition. It is easy to implement, but you must learn vector arithmetic, there is no short cut. – Beta Oct 09 '19 at 18:42

1 Answers1

0

As per the one comment you got, you simply add the Vectors of the forces together.

This is high school physics, not necessarily programming. Godot implements Vectors so that you can literally just add them together.

Vector3(1, 2, 3) + Vector3(-2, 0, 2) == Vector3(-1, 2, 5)```

Also, force and power are very terms in this context, so I'm only assuming that you're working with vectors given that you mentioned GDscript.
Magikarp
  • 171
  • 1
  • 11