Answers for "How to calculate magnitude when resolving collision events?"
http://answers.unity.com/questions/1208615/how-to-calculate-magnitude-when-resolving-collisio.html
The latest answers for the question "How to calculate magnitude when resolving collision events?"Answer by fafase
http://answers.unity.com/answers/1208684/view.html
You may be aiming a bit high with this. Consider the physics engine was developed by hundreds of devs with high level degrees and experience.
But for the sake of learning, you could use the dot product of the direction of the car and the normal of the hit. The dot of two perpendicular vectors will return 0, so if forward and normal are perpendicular, aka the car is hitting on the side and should not bounce too much, then your value is multiplied by something close to 0 and affect just a little:
void OnCollisionStay(Collision col)
{
float dot = Mathf.Abs(Vector3.Dot(transform.forward, col.contacts[0].normal));
transform.Translate(col.contacts[0].normal * CurrentSpeed * dot, Space.World);
}Mon, 27 Jun 2016 06:52:33 GMTfafase