cannon ball direction when fired
Using a previously tried and true set of scripts for my rocket fire, I tried to port them over to a cannon. Problem is that I can't seem to get the cannon balls to come out properly. That is to say if a have the cannon aimed up at 45 degrees ( or anything but perfectly level) the cannon balls come out and go forward parallel to the ground rather than out in an arc. This is the code for it....and I know it has to do with the "transform forward" as that is what it is doing...forward up the Zed axis rather than a lobbing arc. Anyone know what I need to do to change this?
GameObject bullet = Instantiate (projectile, Muzzle.position, Quaternion.identity)as GameObject;
bullet.GetComponent<Rigidbody> ().AddForce (transform.forward * throwDistance);
Your answer
![](https://koobas.hobune.stream/wayback/20220612151100im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
transform.forward problem 2 Answers
Gun script is shooting wrong direction,Script is shooting wrong direction 1 Answer
transform.forward giving unwanted movement 1 Answer
How to make a NavMeshAgent move in the direction it is looking? 4 Answers
How do you maintain gravity using transform.forward and transform.right? 0 Answers