// Update is called once per frame void Update() { if (create_CD > 0.05f) { if (FindObjectOfType<SkeletalHand>()) { hand = FindObjectOfType<SkeletalHand>(); GameObject lightobj = Instantiate(l, hand.GetPalmCenter() + offset, transform.rotation) as GameObject; Destroy(lightobj, 0.7f); hand = null; } } create_CD += Time.deltaTime; }
void Update() { SkeletalHand skeletal_hand = GetComponent <SkeletalHand>(); Hand leap_hand = skeletal_hand.GetLeapHand(); if (leap_hand == null) { return; } if (leap_hand.GrabStrength < GRAB_TRIGGER && handSpawn != null && wait <= 0) { GameObject spawn = Instantiate(handSpawn, skeletal_hand.GetPalmCenter(), Quaternion.identity) as GameObject; spawn.rigidbody.velocity = VELOCITY_SPAWN * (skeletal_hand.GetPalmRotation() * Vector3.down); wait = SPAWN_WAIT_ITERATIONS; Physics.IgnoreCollision(skeletal_hand.palm.collider, spawn.collider); } wait--; }