I cant seem to find answer on internet. I have this attached to a camera:
var projectile : Rigidbody;
var speed =868;
static var bullets = 0;
static var score = 0;
function Update()
{
if( Input.GetButtonDown( "Fire1" ) )
{
if (bullets < 10)
{
var instantiatedProjectile : Rigidbody = Instantiate(
projectile, transform.position, transform.rotation );
instantiatedProjectile.velocity = transform.TransformDirection( Vector3( 0, 0, speed ) );
Physics.IgnoreCollision( instantiatedProjectile. collider,
transform.root.collider );
bullets +=1;
}
else
{
bullets = 0;
score = 0;
Application.LoadLevel(0);
}
}
}
And in a seperate code attached to different object I have this:
function OnControllerColliderHit(hit : ControllerColliderHit)
{
if(hit.gameObject.tag == "Bullets")
{
DragPhysics.score += 1;
}
}
However when Bullets collides with the target the score remains zero.