Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Thakee Nathees |
what’s the best way to interpolate between two angles in 3d?
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Thakee Nathees |
what’s the best way to interpolate between two angles in 3d?
Reply From: | BraindeadBZH |
Usually the best to interpolate values manually is to use the lerp function: @GDScript — Godot Engine (stable) documentation in English
Reply From: | Dlean Jeans |
Use this function:
func lerp_angle(from, to, weight):
return from + short_angle_dist(from, to) * weight
func short_angle_dist(from, to):
var max_angle = PI * 2
var difference = fmod(to - from, max_angle)
return fmod(2 * difference, max_angle) - difference