/*
Наглядно и ясно:)
Left - левая рука
Right - права рука
Up - голова сверху
Down - ноги снизу
Front - живот
Behind - спина
*/
public void OnTriggerEnter(Collider other)
{
if(other.name == "LeftCol")
{
Debug.Log("Левая сторона");
}
if(other.name == "RightCol")
{
Debug.Log("Правая сторона");
}
if(other.name == "UpCol")
{
Debug.Log("Верхняя сторона");
}
if(other.name == "DownCol")
{
Debug.Log("Нижняя сторона");
}
if(other.name == "FrontCol")
{
Debug.Log("Спереди");
}
if(other.name == "BehindCol")
{
Debug.Log("Сзади");
}
}
private void OnCollisionEnter(Collision other)
{
var normal = other.GetContact(0).normal;
var collisionTransform = other.transform;
if (normal == collisionTransform.up)
{
Debug.Log("Top");
}
if (normal == -collisionTransform.up)
{
Debug.Log("Down");
}
if (normal == collisionTransform.right)
{
Debug.Log("Right");
}
if (normal == -collisionTransform.right)
{
Debug.Log("Left");
}
if (normal == collisionTransform.forward)
{
Debug.Log("forward");
}
if (normal == -collisionTransform.forward)
{
Debug.Log("back");
}
}