My cannonball instantiates but just falls flat on the ground instead of moving forward. ‘Is kinematic’ is not checked, and the speed is set to 100, and the mass is 7.2 but still won’t do anything.
public class CannonShoot : MonoBehaviour {
public Transform CannonballSpawn;
public float OriginalSpeed = 5.0f;
public Rigidbody Cannonball;
private void Update()
{
Cannonball = Cannonball.GetComponent<Rigidbody>();
if(Input.GetKeyDown(KeyCode.Space))
{
Instantiate(Cannonball, CannonballSpawn.transform.position, CannonballSpawn.transform.rotation);
Cannonball.velocity = transform.TransformDirection(CannonballSpawn.forward * OriginalSpeed);
}
}
}