Myvideo

Guest

Login

Godot 4 - Angle_Lerp - Angle Between two Vector

Uploaded By: Myvideo
7 views
0
0 votes
0

Автор - Fuzikun ссылка - От автора: ● float lerp_angle(from: float, to: float, weight: float) Linearly interpolates between two angles (in radians) by a normalized value. Similar to lerp(), but interpolates correctly when the angles wrap around @. To perform eased interpolation with lerp_angle(), combine it with ease() or smoothstep(). extends Sprite var elapsed = 0.0 func _process(delta): var min_angle = deg2rad(0.0) var max_angle = deg2rad(90.0) rotation = lerp_angle(min_angle, max_angle, elapsed) elapsed = delta Note: This method lerps through the shortest path between from and to. However, when these two angles are approximately PI k * TAU apart for any integer k, it’s not obvious which way they lerp due to floating-point precision errors. For example, lerp_angle(0, PI, weight) lerps counter-clockwise, while lerp_angle(0, PI 5 * TAU, weight) lerps clockwise.

Share with your friends

Link:

Embed:

Video Size:

Custom size:

x

Add to Playlist:

Favorites
My Playlist
Watch Later