Trying to make a FPS Controller run into a “coin” that then causes the coin to be deleted but the detection isn’t working.
I have a Box Collider on the cube and a mesh collider on the FPS controller. (the FPS Controller doesn’t have a model. - if that makes a difference, i don’t know)
I have this script attached to my cube, the cube with a tag “coin” and my FPS controller “player”.
Any ideas would be appreciated… <3
public class CoinAnimation : MonoBehaviour {
//public float speed = 10f;
public GameObject deathparticles;
void Update ()
{
//transform.Rotate(Vector3.up, speed * Time.deltaTime); //Not connected, makes the coin look cooler.
}
void OnCollisionEnter(Collision Cube)
{
if (Cube.transform.tag == "Player") {
Instantiate(deathparticles, transform.position, Quaternion.identity);
print ("hit");
}
}
}