I am creating a canon that will launch the shots on different angles as guided by the user. I want to show a dotted path that will show the prediction of the path that the gameobject will follow. I want to make something like the game BBTan has. Please see below
I also want it to extend and show the reflected path.
My script is as follows,
public Rigidbody2D Cannon;
public Transform gameobject;
public float ShootSpeed;
Rigidbody2D Player;
float presscount;
// Use this for initialization
void Start()
{
presscount = 1;
}
// Update is called once per frame
void Update()
{
if (presscount == 1)
{
if (Input.GetKeyUp("space"))
{
Player = Instantiate(Cannon, gameobject.position, gameobject.rotation) as Rigidbody2D;
Player.AddForce(gameobject.up * ShootSpeed);
presscount = 0;
}
}
}
Please help… thanks in advance