How to shoot cannon ball in 2d?
I am using cannon sprites which have cannon and a cannon ball separately. I want to shoot the ball from cannon on button press according to the direction of cannon. What I'm doing right now is rotating cannon with buttons shooter.transform.Rotate(Vector3.forward * move * Time.deltaTime);
I'm placing cannon ball right behind cannon by changing layer order. When a button is pressed I want the ball to be shot in according to cannon's direction. I don't know how to shoot the cannon. I'm trying ballRB.AddForce(Vector3.forward * speed);
but it's not working.
Your answer
Follow this Question
Related Questions
Cannons wont move on the vertical axis 0 Answers
Shooting mechanic - can't shoot left and right,2D shooting mechanic - can't shoot lift and right 0 Answers
shooting multiple cannons with delay 1 Answer
Sensing an objects collisions by another object 0 Answers
How could I add "gravity" to a top-down shooter's bullet, such as in The Binding of Isaac? 0 Answers