Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | threadedstream |
Hi! I’ve been trying to wrap my head around proper implementation of arrow shooting. So, I have an archer mob and player. In this particular setup, archer is supposed to shoot player once player enters archer’s watching zone. I want the arrow to fly according to laws of parabolic motion, accounting for a player position as well – so that it’s flying right toward a player.
Here’s what I’ve written so far
xt = launchSpeed * cos(angle) * delta
yt = (launchSpeed * sin(angle) * delta) - (1/2 * consts.g * delta * delta)
position += Vector2(xt, yt)
angle = atan2(yt, xt)
rotation += deg2rad(1)
An initial angle chosen is -pi/4.
What should I do next? Thanks in advance.
Same question, same comment. Here’s the same video: https://www.youtube.com/watch?v=_kA1fbBH4ug
TheJokingJack | 2021-04-12 20:16