Hi, i want to do a game like peggle. I have a rotative cannon and a ball. The ball lauch but don’t lauch in the direction of the cannon. The ball just drop down. I would like that the ball lauch in the direction the cannon is pointing.
Here is what i have for now:
using UnityEngine;
using System.Collections;
public class lancer : MonoBehaviour {
public Transform bouton;
public Transform balle;
public bool lance = false;
public Rigidbody projectile;
void OnMouseDown()
{
if (lance == false)
{
projectile.rigidbody.AddForce(Vector3.forward * 10, ForceMode.Impulse);
balle.rigidbody.useGravity = true;
lance = true;
}
}
}