Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Colliders Beginner question

Discussion in 'Editor & General Support' started by alfred1963, Feb 17, 2008.

  1. alfred1963

    alfred1963

    Joined:
    Nov 14, 2007
    Posts:
    35
    Beginners Question.

    I have this box constantly falling through the floor.

    I need a few guiding hints about how to control the physics of game items.
    How to turn on off all parameters to do with how things fall on how to spot them from passing through each other.
     
  2. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Attaching a Rigidbody will prevent them from falling through other colliders. This will basically make that gameObject use physics.
     
  3. forestjohnson

    forestjohnson

    Joined:
    Oct 1, 2005
    Posts:
    1,370
    Does your floor have a collider? If the object is falling, it probably already has a rigidbody. If you have a script that is moving it's transform, you shouldn't put a rigidbody on it.

    Try this:

    Create a cube from the menu, and duplicate it. then move the duplicate above the original and add a rigidbody to the duplicate. It should fall and hit the original.

    Try to recreate this situation with your case: Both objects have colliders (be aware mesh colliders cannot collide with other mesh colliders unless the mesh collider that moves is marked Convex), and the moving object has a rigidbody.
     
  4. alfred1963

    alfred1963

    Joined:
    Nov 14, 2007
    Posts:
    35
    Thanks that was help full seems I have not got any grasp on the "is trigger" concept as soon as I turn that off it stops falling through the floor.
    Making progress was way to late yesterday.
    Need to do more reading however asking seems to work much faster thanks for your help!

    Sometimes its wise to just walk away and come back rested! Your advise to experiment with cubes helped.
     
  5. 64746c

    64746c

    Joined:
    Oct 21, 2007
    Posts:
    181
    As far as the simulation of physics goes, the isTrigger flag makes the object ignore collisions. As far as scripting is concerned, the "OnCollision" functions are replaced with OnTriggerEnter, OnTriggerExit, and OnTriggerStay.
     
  6. forestjohnson

    forestjohnson

    Joined:
    Oct 1, 2005
    Posts:
    1,370
    Triggers are for things that are not solid but trigger events in scripting, like for example you want to turn on an image effect when the player goes into a cave, but you don't want him to run into a wall that represents the "image effect on" area.