- Home /
Wheel colliders not detecting mesh colliders
Hello,
I have made a race track using Google Sketchup 8 and exported it as .dae. I've then imported it into Unity to use with a car. I added mesh colliders to every object on the track and the track itself. To my car, I've also added mesh colliders. It also has a rigidbody. When I press play, the car falls through the track. When I add wheel colliders, the car still falls through the track. When I add box colliders to the car, it stays but that is not an option for me. I want my game to be as realistic as possible, using wheel colliders to drive the car. Also, checking Convex at the mesh colliders makes the game unrealistic, so it's not an option either. Is there a way in which I can get around this?
My terrain is uneven, that's why I can't use box colliders on it.
I've seen some impressive car games made with Unity, so I'm sure there is a workaround.
Answer by hangemhigh · Sep 06, 2014 at 02:08 PM
Only use Mesh Collider when it is needed. Instead of using Mesh Collider for everything in your scene, use Compound Colliders for your environment. A way of making a simple compound collider is to create many empty Game Objects then assign colliders to each one until you are sure that the colliders covers everything that can be hit by the car. With compound collider, you can use all type of colliders such as box, sphere, capsule, and mesh colliders together. You can also scale, rotate or translate the collider to match the location of your 3D Object.
Make sure these colliders are child of your environment objects so that when you move your objects, the colliders will move with them. The car itself should have compound collider or mesh collider with Bonvex turned on. Add Wheel Collider to the wheels and change the radius to match the size of your wheel. Still not Realistic?
Add a physics material to your wheel with the following setting: Dynamic Friction: 0 Static Friction: 0 Friction Combine: Minimum
This sometimes smooths out the friction from the collision with the track.
I don't know how your track is made but your track is suppose to be modeled in pieces. It shouldn't be one piece. The middle of the track should be constructed with small piece of planes so that mesh collider can easily be assigned to them. This will also make the mesh collider look realistic when you enable convex.
Still not Working? There is a plugin that can help you. I've used it before so I know it will help but it should be your last resort. Concave Collider So to conclude this:
1) Add Pysics Material to smooth out the wheels movement and make it look realistic. Also add Physics Material to the wheels with the setting I provided above. You can adjust it after.
2) Try modeling your track in pieces instead of in one bug chunk, then assign compound colliders to objects such as walls and grasses. Assign Box collider to the middle of the road that your car is suppose to pass through.
3) Use box Collider for the middle of the track where the wheels will be touching with the track. You can scale the collider to match the size of your track. then use wheel collider for the wheel. Make sure to rescale,move the wheel Collider to match the size of the wheel.
4)If you decide to use Mesh Collider for the track and Mesh Collider for the wheel, you should enable Convex on both the track collider and the wheel collider.
5) The worst mistake people make is to place the car a little bit below the track. It will fall through the track when you hit the play button. So, make that the car is above the track/plane and that it is not touching the track/plane before pressing the play button.
6) Use the Concave Collider Plugin
I suggest you try this in this order #5,#3,#1,#4,#2,#6.