2

I am trying to use leap motion to interact with a couple of other game objects. At a very simple level, I have a cube which I need to interact with. For this, I wrote a script -

using UnityEngine;
using System.Collections;

public class DoorDetector : MonoBehaviour {

    void OnCollisionEnter(Collision other)
    {
        Debug.Log("Hello");
    }
}

This should ideally display a Hello in the console on Collision, but it doesn't. I have a mesh collider applied to the body and for the hands, I'm using the RigidRoundHand prefabs. I tried applying a rigidbody (in case the prefabs don't do it already), but that did not work as well.

Programmer
  • 121,791
  • 22
  • 236
  • 328
Zeokav
  • 1,653
  • 4
  • 14
  • 29

2 Answers2

2

You are using Mesh Collider so you must enable Convex on the Mesh Collider.

enter image description here

If this does not solve your problem, simply use the Box Collider like I mentioned in the comment section.

Programmer
  • 121,791
  • 22
  • 236
  • 328
0

It will work if you put RigidBody on that cube where is this script. At least one of colliding object needs to have RigidBody. Also disable IsTrigger in Colliders of Cube and every interactible object.

Universus
  • 386
  • 1
  • 13