Is there an alternative to this Vector2 Dot Product angle calculation?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By fighterwing989

I would like to calculate the angle between the two vectors of a dot product equation. The first vector is the source Node’s facing vector or “front” vector. The second vector is the direction vector that points at the target Node from the source Node. For example:

var direction: Vector2 = $A.global_position.direction_to($B.global_position)
var facing: Vector2 = $A.global_transform.x
var dot: float = facing.dot(direction)
var degree: float = rad2deg(acos(dot))

This seems to work, but is there a different/better way? I found angle_to in the docs, which I don’t fully understand, and angle_to_point, which locks to the X-axis and won’t work I don’t think.