Hi all,
I’m using the following code to detect when my car hits a wall or another collider, when it does it sets off a particle system (collision sparks).
It works fine but, you don’t see the particle system because its always behind you because car is going so fast.
Is there a way for the particle system to follow the car once it is initiated?
#pragma strict
var HudShake : GameObject;
var spark : GameObject;
function Start ()
{
yield WaitForSeconds (1.0f);
HudShake = gameObject.FindWithTag("hud");
}
function OnCollisionEnter (other : Collision )
{
if (other.transform != transform other.contacts.length != 0)
{
for (var i = 0; i < other.contacts.length ; i++)
{
Instantiate(spark,other.contacts[i].point,Quaternion.identity);
HudShake.animation.Play("shake");
}
}
}
Thanks!