I’m currently using OnTriggerEnter with a box collider in front of my car so that when it hits a human model it changes it to a rag doll to give the illusion of collision.
I would like to have more realistic collision physics where I can use OnCollisionEnter and check for relativeforce etc.
The problem I’ve found using OnCollisionEnter on the cars mesh collider, is that it collides, then bounces back then instantiates the rag doll version, would anyone be able to suggest a better solution to creating more realistic collision between a car and a human model?
void OnTriggerEnter(Collider collision)
{
if (collision.gameObject.tag == "Player" || collision.gameObject.tag == "Bullet")
{
//Debug.Log("Trigger hit");
if (collision.gameObject.tag == "Bullet")
{
Debug.Log("Hit by bullet");
}
health.OnNoHealth();
}
}
and this one
void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "Player" || collision.gameObject.tag == "Bullet")
{
if (collision.relativeVelocity.magnitude > 2)
{
health.OnNoHealth();
}
}
}