- Home /
Checking Attack Radius, or "Width"
Hello,
I searched up on attack radii and only came up with literal "circles" and not what I'm after.
It's part of my skill's damage calculation, and i want damage to be calculated if they're within a certain cone in front of the attacking unit.
I was looking at overlapsphere and spherecasting but that's not really what I'm going for.
The main check that i need to do is angular.
Comment
How would I go about making a check so that I could tell if my GameObject's transform.forward is within a certain angle of another gameobject?
Best Answer
Answer by EHogger · May 31, 2013 at 10:02 PM
If ( Vector3.Angle(transform.forward, someGameObject.position - transform.position) < someAngle)
{
Your answer
![](https://koobas.hobune.stream/wayback/20220613103307im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Illuminating a 3D object's edges OnMouseOver (script in c#)? 1 Answer
Rotate angle 0 Answers