- Home /
Turret shooting arrows?
Hey thanks in advance, I'm really struggling with this.
Before we start, I should let you know this is in 3D not 2D, I'm trying out a little tower defense project and I want a turret that can shoot arrows; I found a tutorial how to get a bullet to shoot to the target but that's not what I'm aiming for. This arrow has to first fly up in the sky and then decrease down to the ground/target. because nobody shoots arrow in a straight line like a gun.
If someone could help me that would be great, if you can please explain in detail what I should do, if I see the code I will understand it but the documentation won't help me at all right now.
(Im working in JavaScript)
Answer by AlwaysSunny · Oct 31, 2014 at 02:34 AM
So the whole trajectory of the arrow is visible to the camera? I'm making some other assumptions about the game's nature here, too, but here we go:
Before firing, you must know either where the arrow will land, or which target it will hit. The first approach may include a step for compensating for the intended target's velocity, also known as "leading a shot". The second approach would gradually correct the arrow's path (over time, while in flight) to ensure the chosen target is hit.
From there, the math is fairly simple: http://www.physicsclassroom.com/class/1DKin/Lesson-6/Kinematic-Equations
Your answer
![](https://koobas.hobune.stream/wayback/20220613170404im_/https://answers.unity.com/themes/thub/images/avi.jpg)