I have an object a child of the player called “crosshair” and tagged as such. the object is in front of the player so when THAT hits the trigger zone( not the player) I want the animation on the game object called and tagged “dancertest” to play. But I can’t get it to work and can’t understand why. If I substitute “player” in the script like so at at he end… if(other.tag == “Player”) instead of if(other.tag == “crosshair”) the player then triggers the animation I want. So what am I missing here? Everything seems to be in order or substituting that one word wouldn’t work either. This object called “crosshair” has a box collider on it, name and tag match script
using UnityEngine;
using System.Collections;
public class InAim : MonoBehaviour {
GameObject crosshair;
GameObject dancertest;
Animation animation;
void Start () {
crosshair = GameObject.FindWithTag("crosshair");
dancertest = GameObject.FindWithTag("dancertest");
//animation = GameObject.GetComponent.("dancertest")<Animation>();
}
void OnTriggerEnter (Collider other) {
if(other.tag == "crosshair")
dancertest.GetComponent<Animation>().Play();
}
}