2d parabolic shell

I am looking to create a basic Javascript implementation of a projectile that follows a parabolic arc (or something close to one) in order to reach a certain point. I am not particularly well versed when it comes to complex mathematics, and spent days reading material on the problem. Unfortunately, mathematical solutions are useless to me. I am ideally looking for pseudo code (or even an existing code example) to try to get around it. Everything I find offers only partial solutions to the problem.

In practical terms, I am looking to simulate the flight of an arrow from one place (bow place) to another. I have already simulated the effects of gravity on my projectile, updating its speed on each logical interval. What I'm looking for right now is exactly how I determine the correct path / angle to shoot my arrow in order to reach my goal in no time.

Any help would be greatly appreciated.

+3
source share
2 answers

The clear answer is a good summary of how to simulate the movement of an object, taking into account the initial trajectory (where the trajectory is considered as a direction and the velocity or in combination is a vector).

( ), , O P.

, P , O. .

, (.. [0, 0]), :

T_x = P_x - O_x            // the X distance to travel
T_y = P_y - O_y            // the Y distance to travel

s_x = speed * cos(angle)   // the X speed
s_y = speed * sin(angle)   // the Y speed

(x, y) (t) :

x = s_x * t
y = s_y * t - 0.5 * g * (t ^ 2)

T_x = s_x * t
T_y = -0.5 * g * (t ^ 2) + s_y * t

(t, s_x s_y) . , .

FWIW, s_x s_y speed, angle, - .

, , - , .

NB: , . , , , Pointy , . (.. 10 ), .

+3

, , , , .

  • "" "x" "y", "vx" "vy" . - "x" "y". "vx" - , "vy" - ( , ). , , , .
  • . "" . , 100 ( , ).
  • "vx" "x" "vy" "y". ( , "vx" "vy" .) "vx" "vy" , ( ) . "vx" , :-) "vy" - . , . "delta vy" , , , . (Math-wise, "vy" "y" - , "delta vy" .)
  • "vy" , , " ", .

, , "vy" . "vy" "delta vy" . , , .

edit — . @Alnitak - .

+4

All Articles