- Home /
Colliders getting stuck on and trespassing mesh
Hi!
I'm having some serious problems with collisions and I beg for help. I want to make a game like F-Zero, with vehicles that are attached to the track by some kind of magnetic pull. I managed to get the basic controls working, like orienting the vehicle to the track normals and getting a proper behavior on twisting tracks, upside-down, loops, etc.
However, I got this strange problem as shown on the following picture:
When I'm running through a ramp or curve and hit the wall, the vehicle bounces off of it or if I insist, it runs through it smoothly, like it was supposed to be. But when I'm on a straight part of the track, it gets stuck immediately as soon as I hit the wall, and if I try moving out of it, I can trespass it and fall off the track.
I've tried all kind of colliders for the rigidbody - Convex Mesh, Box, Sphere and Capsule, didn't used Wheel Collider due to obvious reasons. As you can see, the huge Sphere Collider is trespassing the wall collider and any other would do the same.
The track, wall collider and vehicle Physic Materials has 0 friction values.
This happens even if the rigidbody speed is low and I'm using AddForce and not Translate to move it.
Any ideas? ):
Try adjusting the TimeStep to be a bit less than the default for more realistic physics. Also be sure that your rigidbody's collision detection is set to Continuous Dynamic. Be sure too, that you're not using "thin" colliders as your track mesh. Use a second mesh that is thicker, but not rendered, used ONLY as a collider. It is best to have a smooth collider for your mesh, especially a track. Hope this helps.
Also be sure you're not using "thin" colliders as your track mesh. Use a second mesh that is thicker, but not rendered, used ONLY as a collider. It is best to have a smooth collider for your mesh, especially a track.
Answer by luiz_san · May 29, 2013 at 02:01 AM
Guess I figured out what was the problem. And I think it's a bug on Unity! I tried making subdivisions on the straight parts and it worked. I think that if the mesh part is too big, Unity won't handle the collision very well and results in weird things happening.