I reached the Player detection episode, I followed the code Mr.Yan had written, but my camera’s aren’t turning red when the player is inside them. they do turn red, but I have no idea why they’re doing it.
I’ve pasted my Player Detection script placed on my camera arm node below:
extends "res://characters/TemplateCharacter.gd" const FOV_TOLERANCE = 20 const RED = Color(1,0.25,0.25) const WHITE = Color(1,1,1) var Player func _ready(): Player = get_node("/root").find_node("Player",true, false) func _process(delta): if player_in_FOV(): $Torch.color = RED else: $Torch.color = WHITE func player_in_FOV(): var npc_facing_direction = Vector2(1,0).rotated(global_rotation) var direction_to_Player = (Player.position - global_position).normalized() if abs(direction_to_Player.angle_to(npc_facing_direction)) < deg2rad(FOV_TOLERANCE): return true else: return false
I’ve also uploaded a recording of how my camera nodes behave. I have no idea why what’s happening does:
I’m willing to provide more recordings and code to help figure out what the issue is, any help in finding the issue is appreciated.