Godot Version
Replace this line with your Godot version
Question
func check_door() → void:
match forward_direction:
ForwardDirection.X:
door_direction = parent.global_transform.basis.x
ForwardDirection.Y:
door_direction = parent.global_transform.basis.y
ForwardDirection.Z:
door_direction = parent.global_transform.basis.z
var door_position : Vector3 = parent.global_position
var player_position : Vector3 = Global.Player.global_position
var direction_to_player : Vector3 = door_position.direction_to(player_position)
var door_dot : float = direction_to_player.dot(door_direction)
if door_dot < 0:
rotation_adjustment = 1
else:
rotation_adjustment = 1
the problem is: Invaild get index ‘global_position’ (on base: ’ null instance’) can you tell me exactly what to do i can’t figure out these global player positions and scripts like that pls