Comments and answers for "creating 3d melee cone splash attack"
http://answers.unity.com/questions/1333210/creating-3d-melee-cone-splash-attack.html
The latest comments and answers for the question "creating 3d melee cone splash attack"Comment by allcoder on allcoder's answer
http://answers.unity.com/comments/1353107/view.html
Yeah i did this solution
bool frontAttack(Transform target)
{
Vector3 forward = transform.TransformDirection(Vector3.forward);
Vector3 toTarget = target.position - transform.position;
float angle = Vector3.Dot(forward, toTarget);
if(angle > 0.5f && angle < 1.5f)
{
return true;
}
return false;
}
Dot returns 1 if they point in exactly the same direction, -1 if they point in completely opposite directions and zero if the vectors are perpendicular. So angle > 0.5f && angle < 1.5f is a good angleSun, 14 May 2017 04:25:24 GMTallcoderAnswer by Kerno
http://answers.unity.com/answers/1336367/view.html
had to use transformdirecton to solve my problem.Thu, 06 Apr 2017 14:08:55 GMTKerno