#Area detection within a certain angle?

2 messages · Page 1 of 1 (latest)

marble halo
#

Is it possible to detect only a certain angle within an area when a body is entered?

In this instance, I'm using an input direction to get an angle of either 90, 135, 45, 180, 0, -90, -135 and -45.

I want to detect If a body is in that angle +20 or -20 degrees so if we have an angle of 90 the angle would be between 70 to 110 degrees.

The images show how I get the angle from the movement input returning those values.

#

var motion_input = Vector2.ZERO