Rocketlauncer script

Hi,

I’m following the fps tutorial form the unity website but when i write the Rocketlauncer code he gives me a error i will show you my code and error

var projectile : Rigidbody;
var initailSpeed = 20.0;
var reloadTime = 0.5;
var ammoCount = 20;
private var lastShot = -10.0;

function Fire ()
{
	if (Time.time > reloadTime + lastShot && ammoCount > 0)
	{
		var instantiatedProjectile : Rigidbody = instantiate (projectile, transfom.position, transform.rotation);
		
		var instantiatedProjectile.velocity = transfom.TransformDirection( Vector3 (0, 0, initialSpeed));
		Physics.IgnoreCollision(instantiatedProjectile.collider, transformroot.collider);
		
		lastShot = Time.time;
		ammoCount--;
	}
}

but he gives me this error: Assets/Weapon scripts/MissileLauncher.js(13,43): BCE0043: Unexpected token: …

What can i do about it?

Thanks

1 Answer

1

In the line Physics.IgnoreCollision…, you have written transformroot.collider. There should be a period between transform and root ( transform.root.collider). You may already know this, but compile error messages normally say where the error is. The first number in the parenthesis (13,43), tells you that you should be looking at line 13 of the script.