Search Unity

Unity Tree trunk and leaf colliders

Discussion in 'Physics' started by erajomppa, Jan 30, 2019.

  1. erajomppa

    erajomppa

    Joined:
    Jan 30, 2019
    Posts:
    1
    TL;DR: Thrown object must ricochet from the tree's trunk, but should penetrate the leaves. When penetrating leaves, should cause a trigger event so that slowing or trajectory altering forces can be applied.

    So far this is what I'v been up to: I'v been working on a 3D game; a simulator-ish frisbee throwing game. Vegetation plays a huge part in the game. I would love to be able to take advantage of the UNITY's build in features like the tree-object. I could build many different trees quite easy and fast with it. I'v been successful with making the trees, trunks and leaves an all, solid with adding mesh collider to the tree prefab. This just means that the leaves are non-penetrable, so I need to find another solution.
    Next I tried making two identical trees, one with no leaves, other with JUST the leaves. Then making the one with the leaves a TRIGGER collider, but... you need to make the mesh-type collider a convex in order for that to work... That means that the whole area of the tree is one big collider. I need the original mesh that matches the positions of the actual leaves, otherwise it feels really off... Ideally every leaf generated would have it's own collider, thus penetrating multiple leaves would cause greater hindrance.

    That's what I'v come across, but I have not yet found an elegant solution. One would be to leave the leaves without colliders when generating the tree and adding sphere colliders around each patch of leaves by hand... That would be a lot of manual work unfortunately.

    Any tips?