godot-steering-ai-framework/project/src/Utils.gd

10 lines
216 B
GDScript3
Raw Normal View History

class_name Utils
static func clmapedv3(vector: Vector3, limit: float) -> Vector3:
var len2: = vector.length_squared()
var limit2: = limit * limit
if len2 > limit2:
vector *= sqrt(limit2 / len2)
return vector