Search Unity

Can't stop gameobject (imported obj file) from falling through the terrain

Discussion in 'Physics' started by conorgriff1986, Nov 4, 2018.

  1. conorgriff1986

    conorgriff1986

    Joined:
    Nov 4, 2018
    Posts:
    6
    Can someone please advise me how to stop my character falling through the terrain?

    The character is an imported obj file and once I add a rigidbody component, he falls right through the terrain. Bandicam_-_Unity.png
     
  2. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    Two rigidbodys with concave(non-convex) mesh colliders cant interact.

    You dont put a mesh collider on the terrain, theres already a terrain collider there(a terrain collider is a special mesh collider optimized to work with the terrain system)

    Also, most of the time having a mesh collider on the player is just overkill.
     
    conorgriff1986 likes this.
  3. conorgriff1986

    conorgriff1986

    Joined:
    Nov 4, 2018
    Posts:
    6
    Thanks for the reply. But not sure what do I need to change to get it to work?

    Bear in mind that I'm a complete beginner so apologies for the basicness of my knowledge!
     
  4. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    1) remove the mesh collider from the terrain
    2) either make the player collider a primitive(box, capsule, any thing that's not a mesh collider) or mark it as convex
    3) profit/come back to troubleshoot some more
     
    conorgriff1986 likes this.
  5. conorgriff1986

    conorgriff1986

    Joined:
    Nov 4, 2018
    Posts:
    6
    worked! Thank you!!!