Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Torus collider on ProBuilder shape not working properly.

Discussion in 'World Building' started by joelcarlson, Apr 27, 2022.

  1. joelcarlson

    joelcarlson

    Joined:
    Apr 7, 2014
    Posts:
    47
    I'm not really sure what's up, but I'm trying to create a 'ring toss' game and the torus collider is acting like a box collider. Nothing will go through it. You can see it here, leaning against a box that it's supposed to 'ring'. Any help would be appreciated!

    upload_2022-4-27_9-59-40.png
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    For colliders on Rigidbodies they must be marked convex. You'll notice your MeshCollider is marked convex. This means it is more like a flat coin than a torus.

    Alternately you can make a ring of colliders around it, perhaps a ring of small SphereColliders, each sphere the small diameter of your torus considered as a "pipe" going around its bulk.
     
    kaarrrllll likes this.
  3. joelcarlson

    joelcarlson

    Joined:
    Apr 7, 2014
    Posts:
    47
    Okay, good to know! Thanks for the response.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    Absolutely... I have a script to add colliders like this along a plane... I hacked it up to make colliders in a ring if you want to save some time from setting the spheres all by hand.

    The script: be sure to stick it in an Editor folder!

    https://gist.github.com/kurtdekker/40f845af183b7532b22f04d01443dd77

    Controls:
    Screen Shot 2022-05-02 at 4.10.58 PM.png

    Looks like this when finished:

    Screen Shot 2022-05-02 at 4.00.00 PM.png

    As my Daddy always says, "Better living through Editor Scripting."
     
    kaarrrllll and joelcarlson like this.
  5. joelcarlson

    joelcarlson

    Joined:
    Apr 7, 2014
    Posts:
    47
    Thank you! This is wonderful!
     
    Kurt-Dekker likes this.