Hi,
I’m creating racing game and I don’t know how to instantiate sparks in collision point, can someone help?
Thanks a lot.
Hi,
I’m creating racing game and I don’t know how to instantiate sparks in collision point, can someone help?
Thanks a lot.
Hi,
When you have a collison (assuming you are using OnCollisionEnter) then point of contact is stored in then Collision object. It’s accesible by “collision.contacts”.
void OnCollisionEnter(Collision collision) {
// 1st point of contact
ContactPoint contactPoint = collision.contacts[0];
// Create the prefab at the contact point of the collision
Instantiate(prefab, contactPoint.point, transform.rotation);
}
I can’t test it right now to test this… let me know if it helped =D