- Home /
Throwing random projectiles in a parabolic trajectory
I'd like to know how could I make a non-player character throw random projectiles in a parabolic trajectory. With random I mean each projectile has a different angle, and can fly a different length. Like if you were watching somebody play Angry Birds.
As a newbie who has just started programming in Unity, I'll appreciate any help. :)
The code is just a few short lines, but there are some things you need to master in order to get there. Start with a goal of getting a projectile to fire. Your Angry Birds makes me thing this is a 2D app, but you don't say if this is a 2D or 3D app. Here are some things to research:
Rigdibody
Rigdibody2D
AddForce (Rigidbody or Rigidbody2D)
Prefabs
Drag and drop initialization of variables in the Inspector
InvokeRepeating
There are lots of posts on how to shoot a projectile. $$anonymous$$aking something shoot randomly is just a bit of frosting on top of code that is shooting a projectile.
Your answer
![](https://koobas.hobune.stream/wayback/20220613140452im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Throwing Objects 2 Answers
Using arrays to randomly select an object 0 Answers
Random Range Seems... Unrandom 1 Answer
Random object placement. 1 Answer