#Up vector and direction between node origin and target are aligned, look_at() failed.

5 messages · Page 1 of 1 (latest)

pliant stirrup
#

Up vector and direction between node origin and target are aligned, look_at() failed.

half tiger
#
  var target: Vector3= target.global_position
  var look_vec= (target - global_position).normalized()
  if not look_vec.is_equal_approx(Vector3.UP):
    look_at(target)

something like this should work to make sure you are not trying to look directly up, which would be the same direction the look_at() function is trying to use as a fixed axis by default in 3d to orient itself.

#

you can replace target by whatever position you are trying to look at

#

Sometimes tho, you dont want to use the default UP vector as axis for look_at(). Depends on what you are doing.

pliant stirrup
#

Sorry for deleting the original message, I thought that'd delete the forum post lmao.
I managed to fix this by adjusting the behavior of my look_at function to be more aligned with what I wanted; only turning on the y axis, so i just assigned the x and z axes rotation degrees immediately afterward.
(edit: this doesn't actually work lol. i was confused)