What is the replacement of GDScript lerp that accept Variant args in c#? ( documentation is wrong )

Godot Version

4.2

Question

If i look at the documentation i can see that :
If i like to replace the GDscript lerp to c# i can use :
lerp = Mathf.Lerp

but this is wrong :
in GDscript the signature is taking variant
(@GlobalScope — Godot Engine (4.2) documentation in English) :

But what is the replacement in c#? Mathf.Lerp accepts only floats .

So for example if i like to create Lerp in the code ( this will not work )
direction = Mathf.Lerp(direction,(Transform.Basis * new Vector3(inputDir.X, 0, inputDir.Y)).Normalized(),LerpSpeed*delta);

Thanks

Use Vector3.Lerp instead it.
By the way, function lerp is not type safed. So you should use lerpf(Mathf.Lerp) Vector2.lerp(Vector2.Lerp) etc.
It’s described in the bottom of that function’s description.

Thanks but i dont undersatnd how to convert 3 arguments that GDscript take to
2 ?

For example:

in GDScript i have :

direction = lerp(direction,(transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized(),delta*3)

How does it translates exactly to c# with Vector3 .lerp where it takes 2 arguments ?

direction = direction.lerp((transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized(),delta*3)
1 Like