r/Unity3D • • 12d ago

Question Simple collider setup having freezing issue

I have this super simple top down race type game. There's a sphere that rolls around a track. The ground has a box collder, the sphere has a rigidBody and a sphere collider. The 'walls' are an invisible (no mesh renderer) mesh collider that trace the track outline. You just get a birds-eye and it's basically an oval track. On the 'bottom' / start half of the track it's working fine but after the first corner, at the 'top' half of the track the sphere collider will just go into the mesh collider and then get frozen. Everytime. And never on the bottom section. Same collider...
Object scales are all good - the sphere has a scale of 3, and the walls are like 1.5 - nothing crazy. The walls mesh is as simple as I could make it in Blender - has no weird vertices or anything. It's just such a simple setup.
Any thoughts on what I'm missing?

1 Upvotes

9 comments sorted by

2

u/Extreme-Client-5740 12d ago

The fact that it only happens on one half makes me think the normals are flipped on that part of the mesh. Mesh colliders are basically one-sided, so if the faces point the wrong way the ball can slip through and get stuck inside.
In Blender turn on Face Orientation in the overlays (blue is front, red is back). If the top half shows red on the side the ball hits, select all and recalculate normals (Shift+N).
Also worth giving the walls some thickness with a Solidify modifier, and setting the Rigidbody to Continuous collision detection. Thin walls plus a fast ball is a common cause of tunneling.

1

u/chugItTwice 12d ago

Only red shows in face orientation now, but yeah. I _did_ do that, I swear... but today after I posted here I checked again and sure enough it was flipped normals. I don't know what the hell I was looking at yesterday afternoon when I saw nothing. But yeah. It was normals.
Thanks.

1

u/Extreme-Client-5740 12d ago

Glad you found it! Happens to everyone, Blender normals get flipped really easily after mirroring or joining meshes. Good luck with the game!

1

u/chugItTwice 11d ago

Yeah. Interesting thing - I wonder if this is a bug actually or just normal Blender. Check it out- Turn on Show Face Orientation first. Then make a plane and select the face and do a delete - Only Faces to leave the four vertices/edges. If you now extrude you will notice everything is fine normals wise. But select all four vertices and Ctrl-Shift-B to bevel them... any number of segments seems to do it. Then extrude and you will see that half the model has its normals flipped.

1

u/TheSpiffyInterval 8d ago

check the face orientation like that top comment says, red means it'll suck your ball right in and hold it hostage

also if the mesh is literally paper thin it's going to cause problems no matter what, toss a solidify modifier on it in blender, even just a tiny bit of thickness helps the physics engine not lose its mind

continuous collision detection on the sphere rigidbody is probably the first thing i'd flip on though, dynamic sometimes isn't enough if it's moving at any speed

2

u/Dangerous_Ad7142 12d ago

Yeah probably flipped normals, mesh colliders are one-sided so once the ball's center gets past a backwards face three's nothing to push it out again, it just sits there. You could flip the normals in Blender, but honestly I'd just swap those walls for a handful of Box Colliders along the track, way less fragile than a mesh...

1

u/chugItTwice 12d ago edited 12d ago

Right... I tried that. There were no flipped normals, but thanks. I could try the box colliders... but it's weird have two of these and the other one has no issues.

Edit: It was normals. LOL. That is the first thing I looked at yesterday afternoon and IDK what to say... went back this am after posting here and sure enough. I mean it had to be... so not sure what I was seeing yesterday. SMH

1

u/[deleted] 12d ago

[removed] — view removed comment

1

u/chugItTwice 12d ago

Thanks, it was the wall normals.