A player shoots on a vehicle. If it shoots correctly, a flame starts to burning on the car after hitting. The flame should go with the vehicle if the vehicle is moving. But the flame does not moving with the vehicle, how to solve this issue? I used OnCollisionEnter (see below).
Thanks in advance.
Dave
var SmallFlame : GameObject;
function OnCollisionEnter (collision : Collision) {
var contact : ContactPoint = collision.contacts[0];
var rotation = Quaternion.FromToRotation(Vector3.up, contact.normal);
var CollidedObj : String = collision.transform.name;
if (CollidedObj == “Vehicle1”) {
Instantiate (SmallFlame, contact.point, rotation);
}
}