I have run across this error with the FPS script using Unity 3, I have researched the functions and it seems to be alright but Im missing something. Could I get a fresh set of eyes and let me know what you think? Thanks!
var projectile : Rigidbody;
var speed = 20;
function Update ()
{
if( Input.GetButtonDown( "Fire1" ) )
{
var instantiatedProjectile : Rigidbody = Instantiate(projectile, transform.position, transform.rotation );
instantiatedProjectile.velocity = transform.TransformDirection( Vector3( 0, 0, speed ) );
Physics.IgnoreCollision( instantiatedProjectile. collider,transform.root.collider );
}
var explosion:GameObject;
function OnCollisionEnter( collision : Collision )
{
var contact : ContactPoint = collision.contacts[0];
var rotation = Quaternion.FromToRotation( Vector3.up, contact.normal );
var instantiatedExplosion : GameObject = Instantiate(explosion, contact.point, rotation );
Destroy( gameObject );
}
}
Here is the error:
Assets/Scripts/LazerCode.js(16,10): BCE0044: expecting (, found 'OnCollisionEnter'.