Hi there. Sorry to bother you with my stuff, but I cannot solve the Problem by myself. I try to instanciate a Fireball for my Wizard. But the Game always interrupts my script before LogPoint 2:
var projectile : Rigidbody;
var speed : int = 800;
function Update () {
if ( Input.GetButtonUp("Fire1") )
{
// Instance and give godspeed
var myInstance : Rigidbody;
Debug.Log("1");
myInstance = Instantiate(
projectile, transform.position, transform.rotation);
Debug.Log("2");
myInstance.velocity =
transform.TransformDirection( Vector3( 0, 0, speed ) );
// Turn off collision with player
Debug.Log("3");
Physics.IgnoreCollision( myInstance.collider, transform.root.collider );
}
}
I have tried to set projectile to GameObject and modified the second Line according to it (gameObject.rigidbody.velocity) but the error remains. There are several threads about it on the forums, but I was unfortunately not able to solve it by reading those threads. The solutions there did not work. This sample is from the fps-tutorial, so I assumed it worked.
The message: