I’m working with the ShootBallFPS script, but I’d like to change the ball that gets shot. I set my new ball (cannon_shot) up as a Rigidbody, and a prefab, but it isn’t an available choice when I go to the inspector unless it is also on the stage.
Is there something else I need to do, or can I only Instantiate objects that are present on the stage?
var ball : Rigidbody;
var velocity = 30.0;
function Update ()
{
if (Input.GetButtonDown ("Fire1"))
{
var shoot :Rigidbody = Instantiate (ball, transform.position, transform.rotation);
shoot.velocity = transform.rotation * Vector3.fwd * velocity;
}
}