Does this fail its job when the player is close to 45°, 135°, 225° and 315° to the forward vector of the cube? This would make sense to me. What do you actually mean when you say it fails? Do 2 of the equal nodes become true? Or what’s happening?
Generally, trigonometric functions in computers are pretty tricky. They are never exact. Though I don’t think the accuracy of the ACosd node is the problem. What you’re doing looks correct for me but overly complicated. Why don’t you just calculate the angle to the actor forward vector and check if it’s between 45° and 135°, 135° and 225° and so on. That is way less error-prone I think. Is there generally a reason you’re doing this in 3D space? Doing everything in 2D will have less sources of error. You can get the angle between vectors in the range 0,360) by using the determinant in addition to the dot product.
You’re currently calculating a trigonometric functions 7 times. My approach would only need 1. Trigonometric functions do need a lot of operations. What you do may become pretty heavy on performance when you need to execute your logic often times.
Hey Pepeee
thanks for the support, I understood the math you suggested but, i didn’t fully understand how to replace the degrees range with blueprints (specifically how to use the “Atan” function).
Could you be so kind to show me how to replace the degrees within the bp graph?