Search Unity

OnTriggerEnter for moving objects work differently?

Discussion in 'Scripting' started by ArmarageX, Dec 4, 2012.

  1. ArmarageX

    ArmarageX

    Joined:
    Aug 5, 2012
    Posts:
    21
    Hey guys.. quick interesting question....hopefully I'm not asking something already posted..

    I have a BOX and a BALL
    Box has a script that i can use Arrow keys to move around. Ball is a collectable item.

    Im using OnTriggerEnter() to make a simple collecting mechanic

    I make the BALL become a trigger and BOX is a rigid body... i can totally detect it.

    I make the BOX become the trigger.... and the BALL has rigidBody... and it no longer detects.

    Because the Box moves, hence the trigger stops working. I can put a rigidbody on Both of them... and it will work fine again..
    Some threads have mentioned that triggers are meant to be used on static objects.

    Does that mean rigidBody enables the trigger object to start calculating its position per frame, enabling it to work if moved?

    And does that mean that ticking on Trigger, tells Unity to start assuming that it is going to be a static object, unless override with an extra Rigidbody component..

    Would like to ask if anyone knows the logic behind this...

    Thanks!
     
    Last edited: Dec 4, 2012
  2. ArmarageX

    ArmarageX

    Joined:
    Aug 5, 2012
    Posts:
    21
    Well i guess with a bit of reading... i found something in the documentation. Sorry for being a noob and rushing to post.
    Was gonna delete this post... but i hope leaving it here would help someone in the future >.<

    http://docs.unity3d.com/Documentation/Manual/Physics.html