Godot Version
4.4
Question
I have a navigation agent3d and the following code:
func _toPoint(delta):
var dir = global_position.direction_to(navAgent.get_next_path_position())
velocity = dir * speed
look_at(navAgent.get_next_path_position(), Vector3(0,1,0))
move_and_slide()
In 4.3 the player turned to the position and walked towards it. In 4.4 the player rotates in place, merging with the ground and every frame this error shows up:
W 0:00:02:567 ClickToMove.gd:66 @ _toPoint(): Target and up vectors are colinear. This is not advised as it may cause unwanted rotation around local Z axis.
<C++ Source> core/math/basis.cpp:1058 @ looking_at()
<Stack Trace> ClickToMove.gd:66 @ _toPoint()
ClickToMove.gd:29 @ _process()
The line 66 is the look_at line in the first code block.
Tried to block rotations, set diferent up directions but i was unable to solve it
The function get_next_path_position() will return the agents parent node if it doesnt have a next position.
The colinear error is indicating that the up vector used with look_at and the returned path position are the same direction.
I dont think look_at is the issue, its probably your navigation path, or an unhandled edge case where the path and up vector of look_at are identical.
But on 4.3 worked tho.
I dont think think its the lack of a next position
Ive placed breakpoints and the player and the next target is not the same
The function was changed between 4.3 and 4.4. but 4.3 would not log a fatal error unless a build flag MATH_CHECK was defined. 4.4 now tries to resolve the issue and only reports a warning.
So it seems like its still your navigation input is the issue. If the cross product of the next path with up vector is near zero, it is mathematically an issue. You can also just ignore it as it is a warning.
Or i would move your agent away from the first path position.