by Apeirogon » Sat Oct 13, 2018 11:11 am
It depends on vectors. As I said before, one vector represent camera and it angle/pitch, or any other vector, and are unit vector, another position of actor/point in world relative to "camera" actor.
With the assumption that both vector placed in one plane, which placed in 3d space, find scalar product, divide it on product of a length of both vectors and the find arccosine of result number. Final result return angle, between 0-180, between vectors.
If require, it can return how much, and in what axes, you need to turn second vector to make it parallel to first.
But this is actually more hack than actual check_if_in_fov(something). For default cuboid doom actors it required 8 calls to distance_3d, to check all 8 angles. But distance check CAN be reduced from sqrt(number) to arcsin(another number).
I try to understand how c++ find square root, but looks like it not something what I learned in...school I think.
- Screenshot_2018-10-13-20-20-15.png (26.46 KiB) Viewed 1223 times
It depends on vectors. As I said before, one vector represent camera and it angle/pitch, or any other vector, and are unit vector, another position of actor/point in world relative to "camera" actor.
With the assumption that both vector placed in one plane, which placed in 3d space, find scalar product, divide it on product of a length of both vectors and the find arccosine of result number. Final result return angle, between 0-180, between vectors.
If require, it can return how much, and in what axes, you need to turn second vector to make it parallel to first.
But this is actually more hack than actual check_if_in_fov(something). For default cuboid doom actors it required 8 calls to distance_3d, to check all 8 angles. But distance check CAN be reduced from sqrt(number) to arcsin(another number).
I try to understand how c++ find square root, but looks like it not something what I learned in...school I think.
[attachment=0]Screenshot_2018-10-13-20-20-15.png[/attachment]