#Raycast rotation clamps in theory but not at runtime (Godot 4.2)

1 messages · Page 1 of 1 (latest)

faint hawk
#

i have this function scan_vision() which runs every frame so long as the enemy is in the "scanning" state. the intended purpose of the function is for the raycast attached to the enemy to rotate back and forth in a cone shape (confined to 50 degrees in either direction) until it collides with the player and switches the state to "seeking."

what happens at runtime is a different story. i have a print statement set up to see the rotation of the raycast, and the numbers for the y-rotation do seem to line up, but the actual, physical raycast appears to rotate around the entire radius of the enemy. in the video i've attached, i approach the enemy from behind and the raycast collides with me, which should not be possible. ive even clamped the rotation to the confines, and the actual enemy body is not rotating during the seeking state. there doesn't seem to be any other factors interfering with the ray's rotation, and yet it is clear as day that's not the case. any help would be appreciated, even if it requires refactoring my code.

faint hawk
#

node setup if this is any help

faint hawk
#

<@&1349109171240439858> hey its been a few hours since i first asked abt this, any help or insight would be greatly appreciated ^^