Problem detecting Player looking towards NPC

Godot Version

4.5

Question

The function should return true when the player is looking towards the npc, however i think the basis.z is just returning global z.

The code …

var vecToTarget = nav_agent.target_position - position
var dotProd = vecToTarget.normalized().dot( -(player as CharacterBody3D).basis.z)

if dotProd > 0.8:
    return true

return false

Ah its ok, i wasnt rotating the CharacterBody3D, i was rotating the root of the animated model…

(player as PlayerBody3D).player_mesh.basis.z