LeapMotion Trigger Setup

Using Leapmotion to touch and trigger GameObjects in the scene.

This script first creating the leapmotion colliders and upon trigger activation, The GameObject will change color.

using UnityEngine;
using System.Collections;

public class leapCollider : MonoBehaviour {

    public Color colorStart = Color.red;
    public Color colorEnd = Color.green;
    public float duration = 0.5F;
    public Renderer rend;

    // Use this for initialization
    void Start () {
        rend = GetComponent<Renderer>();
    }

    // Update is called once per frame
    void Update () {

    }

    private bool IsHand(Collider other)
    {
        if (other.transform.parent && other.transform.parent.parent && other.transform.parent.parent.GetComponent<HandModel>())
            return true;
        else
            return false;
    }

    void OnTriggerEnter(Collider other) 
    {
        if (IsHand(other))
        {
            float lerp = Mathf.PingPong(Time.time, duration) / duration;
            rend.material.color = Color.Lerp(colorStart, colorEnd, lerp);
        }  
    }

}