- Home /
Question by
lhocraffer · Nov 09, 2015 at 01:03 PM ·
animationcollidercolliderscollision detectionaugmented-reality
How can I change animation with colliders? Using AR and Vuforia.
I am using AR (Augmented Reality) to display models over marker cards. The models are animated and I am trying to get them to change animation when they get close to each other. I am trying to use colliders for this. I have is trigger checked on one model and not on the other so that the trigger will detect the rigid body collider on the other model. My script is below. The models display and animate initially but do not change with proximity. Any guesses on where my mistake is?
using UnityEngine; using System.Collections; using System;
public class LRH_collider_script : MonoBehaviour {
void OnTriggerEnter(Collider other)
{
GetComponent<Animation>().Play("New Animation2");
//Debug.Log("Object Entered the trigger");
}
void OnTriggerStay(Collider other)
{
GetComponent<Animation>().Play("New Animation2");
}
}
Comment