- Home /
Simple Method to check if a GameObject is looking beyond a certain angle limit in 3D Space
What I want to accomplish is to check whether an object is looking in between a minimum and maximum angle in 3D space
for example if a Helicopter is looking directly down
it would have to check whether its rotation vector is within a cone like shape
when, the heli's rotation vector is inside, the method returns true, but false otherwise. The answer is fairly simple in 2D as all I have to do is check whether min < heli rot angle < max
, but in 3D I have to look at 2 dimensions against the Y axis to start.
I could define a cone class and check whether a vector is projected from the origin, but it seemed too excessive as I dont need variables like cone length or inner radius. I feel like I'm missing something simple that involves a bit of playing around with SOHCAHTOA from xz to xz->y. Is it possible to accomplish something similar just by checking heli's rotation xyz?
Your answer
Follow this Question
Related Questions
Blackout 3D Cone of vision/Line of sight 0 Answers
[C#] AI Behaviour in spherical way like RESOGUN based on Rigidbodies. 1 Answer
Input.GetAxis 3d 0 Answers
Limit & Scaling Translation Rate. 0 Answers
Unity Bug when I press play 1 Answer