Curved 3d Collider

In my game I am using splines to create rails that the player can grind on.

The problem I have is that each rail needs one long, continuous collider that spans the whole length of the rail.

For short, or relatively straight rails, I just have to place one box collider that covers the whole rail, but If I want to use curved rails, I would need to use multiple colliders, which would dismount the player as they leave one collider and my OnTriggerExit() function is called.


I’ve been trying to use the EdgeCollider2d collider instead, as you can configure the points to create one curved collider, but I have been having trouble setting it up in my scenes.

Is there a way I can create a 3d curved collider for each of my rails?

Or alternately, is there a way that I could write a OnNotTriggerStay() command? -So that I can just place box colliders along my rail as per usual.

Please don’t link me to other questions, I’ve already done lots of research.

Thanks! All help is appreciated!

You simply need a mesh collider that uses the same curved rail mesh as you use for your renderer: Unity - Manual: Mesh Collider component reference