Hello Unity3D.I have a problem with onTriggerEnter.My problem is that i am trying to make my opponent play different animations depending on the animation that the player is colliding with.For example im trying to make my opponent play a “Fall” animation whenever my character plays a headbutt animation and it collides with the opponent.Which code would be better for this situation? OnCollisionEnter or OnTriggerEnter? If anyone knows how to make it that my opponent play animations depending on the animation that the player hits the opponent with.Can someone please tell me how?I have been stuck all day…
#pragma strict
var setOnFire : ParticleSystem;
var player :Transform;
var speed = 30;
var pushPower = 2.0;
var sceneCam : GameObject;
sceneCam = GameObject.Find("MainCam");
function Start ()
{
setOnFire.Stop();
}
function OnTriggerEnter (Col : Collider)
{
if(Col.tag == "Player")
if(!animation.IsPlaying("Headbutt"))
if(!animation.IsPlaying("Sidekick"))
animation.Play("Hit1");
sceneCam.transform.position = Vector3(2.456752, 1.770302,-1.047782);
sceneCam.transform.localPosition = Vector3(0.09087142, -0.4796396, 0.0500228);
animation["Fall"].speed=1;
{
setOnFire.Play();
}
}