Working on a car engine, I was wondering why most of the time I had a collision with another car ( 2 box colliders ), instead of just seeing the two cars behaving correctly and staying on the road, my car was going up, leaving the ground, as if the collision impulses applied by Unity were directed toward the sky.
Then I checked the collision points and normals, and found that in such cases, normals were really pointing up.
Do I interpret badly the meaning of the normals? Aren’t they supposed to be the “collision planes”?
Are there solutions to make the collisions behave correctly? (knowing Unity deals directly with the collision impulses)
This can happen with a wheel collider when it suddenly passes over a sharp edge. The “wheel” is actually simulated by casting a ray downward. When the wheel ray hits a gentle ramp, there is no problem, but if it encounters a high, sharp edge, it will behave as if the spring has immediately been highly compressed. The spring reacts and throws the car into the air.
The easiest way to avoid this is to add capsule colliders to approximate the shapes of the wheels. Make these colliders of slightly smaller radius than the wheel colliders (say about half to two-thirds the size). Also, it’s best if you put a very slippery or frictionless physic material on the capsules so they don’t introduce their own friction effect.
Thanks for your reply andeee.
I don’t think it’s the problem, as the terrain is just flat, and all cars objects are flagged to ignoreraycast. That’s really strange.
Are you saying that after a collision, the car carries on rising into the air as if being lifted by rockets or something? This could happen if the wheel collider gets compressed and then trapped behind a collider on the car somehow. (I’m not sure how that could happen in the situation as you’ve described it, though.) Is there any other piece of information you think might be relevant?
Don’t really know what to say, except that using box colliders for wheels and joints for suspension instead of wheelcolliders, I have no problem with the collisions.
When I said “rising into the air”, I meant that the front of my car when entering into a non moving car ( and not at high speed ), most of the time, rises up and goes onto the other car, instead of just pushing the other car ( and masses are the same ).
So this non-moving car is a rigidbody not scene geometry, and you’re suggesting that 100% of the energy is imparted to the colliding vehicle and nothing to the stationary one?
Your description isn’t all that clear, perhaps you could generate a webplayer so we could see what you’re actually talking about.