Search Unity

Smooth curved collider

Discussion in 'Physics' started by Monique_Dumont, Oct 20, 2020.

  1. Monique_Dumont

    Monique_Dumont

    Joined:
    Feb 18, 2020
    Posts:
    41
    Hi,

    So I want to do a looping with my cart, but the cart is slowed at each transition between the box colliders of the rails. I also tried to add a mesh collider to the whole looping but it's a concave structure.

    I made a quick video so you can see what I mean :


    Is there a way to smoothen the curve so that there is no collision when the cart goes from one rail to the next ?
     
  2. Monique_Dumont

    Monique_Dumont

    Joined:
    Feb 18, 2020
    Posts:
    41
    I found a solution, i'll post it here in case someone in the future has a similar problem. Please consider though that I don't think my solution is good at all, but it'll do for now.
    So I added inbetween box colliders to smoothen the curve and added a 0 friction material.
    I also encompassed the whole looping into a big trigger sphere collider and I change the cart's physics material to a 0 friction one when he enters the collider. Of course setting it back to the previous material when he leaves.

    The result is smooth enough to give the illusion that I know what I'm doing haha
     
  3. Magic73

    Magic73

    Joined:
    Jun 23, 2015
    Posts:
    132
    mmm have you tried to use wheels with a bigger radius?
     
  4. Monique_Dumont

    Monique_Dumont

    Joined:
    Feb 18, 2020
    Posts:
    41
    You mean WheelColliders ?
     
  5. Magic73

    Magic73

    Joined:
    Jun 23, 2015
    Posts:
    132
    Yes, with larger wheels so that the carriage body does not collide with the track pieces when turning.
    (at first, you may try to simply shrink the collider of the body)
     
  6. Monique_Dumont

    Monique_Dumont

    Joined:
    Feb 18, 2020
    Posts:
    41
    Yes I tried everything but the cart was still doing abrupt stops when hitting a new collider. It doesn't surprise me since it also does that on adjacent horizontal colliders.