Search Unity

Help with simple Collision Detection, no rigid bodies.

Discussion in 'Editor & General Support' started by Juan, Jun 30, 2009.

  1. Juan

    Juan

    Joined:
    May 21, 2009
    Posts:
    142
    Ok, i saw a few post about that but none of them are solving this problem.

    I have a simple scene.

    One Box

    one Plane

    Both objects created within unity and both objects with colliders (The plane a mesh collider, the box a box collider)

    Now i'm using an script to move the box up and down, now i want to print a message everytime the box crosses the plane, something like

    print ("i Crossed");

    One script i'm using is this, but don't work, i was looking for the solution within the help, but i cannot find anything.
    Code (csharp):
    1.  
    2.  
    3. function Update () {
    4. }
    5. function OnCollisionEnter(collision : Collision) {
    6.     print ("kaka");
    7. }
    8.  
    9.  
    Help please! i need this to understand the collisions.

    Thanks!
     
  2. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
  3. Juan

    Juan

    Joined:
    May 21, 2009
    Posts:
    142
    I tried too
    Code (csharp):
    1.  
    2. function OnTriggerEnter (other : Collider) {
    3.     print ("kaka");
    4. }
    5.  
    But after that i noticed that:

     
  4. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
    You need to attach a rigidbody and make it kinematic.
     
  5. Juan

    Juan

    Joined:
    May 21, 2009
    Posts:
    142
    Thanks, it workied...it's not too elegant, but is working :)