Noticias

¡RECUERDA QUE SI ERES UN NUEVO USUARIO, DEBES PRESENTARTE PARA PODER PUBLICAR MENSAJES! | TENEMOS CANAL OFICIAL DE TELEGRAM: t.me/unity3dspain

Dectectar collision

Iniciado por Gastonspas, Agosto 04, 2017, 05:39:31 AM

Tema anterior - Siguiente tema
Hola gente disculpen las molestias pero quisiera saber por que no dectecta la collision de cada objecto dejo un video para mostrar mejor
 


   
eature=oembed" width="480">

 
 
 

function OnTriggerEnter(other : Collider)
{
if (other.gameObject.tag == "ru_men_die")
{
   cualsera = 1;
   Debug.Log(cualsera);
}
if (other.gameObject.tag == "ru_mas_die")
{
   cualsera = ;
   Debug.Log(cualsera);
}
if (other.gameObject.tag == "ru_x2")
{
   cualsera = 2;
   Debug.Log(cualsera);
}
if (other.gameObject.tag == "ru_balas")
{
   cualsera = 3;
   Debug.Log(cualsera);
}
if (other.gameObject.tag == "Player")
{
   cualsera = 4;
   Debug.Log(cualsera);
}
}

 
 

La deteccion de colision se da entre objetos especificos, existe la famosa tabla en las referencias que te dice que objeto con que esta habilitado, ponele al objeto trigger movil (o a uno de los dos, o a todos los cuerpos) un rigidbody (kinematico) y deberia imprimir correctamente, pero te recomiendo revisar la tabla que mencioné tu caso seria collider vs rigidbody, fijate que collider vs collider no existe creo.

te falta agregarle un rigidbody junto con el collider:
 
"Notes: Trigger events are only sent if one of the Colliders also has a Rigidbody attached."

https://docs.unity3d.com/ScriptReference/Collider.OnTriggerEnter.html )
 
mirate: https://unity3d.com/es/learn/tutorials/topics/physics/detecting-collisions-oncollisionenter

Etiquetas: