I don't know why both the godot interpolation function for vector 3 doesn't work for my vairable nor my own doesn't work it stops mid way through interpolation can anyone hep me? this is the code

    MrQUIVY is this for a transition or rotation?
    for rotation you need a unit vector (normalized) but it should throw an error.
    I think you also need to use Slerp instead of Lerp.

    there could also be a problem with rotation gimbal lock.

      Jesusemora this is for a transition to a new vector and I have also used slerp too and it just makes it not normalized. and that is a problem for my engine

        MrQUIVY I don't know what the F you are trying to do.
        translation interpolation is easy and can be done in one line of code.
        maybe your problem is you are using C#, and C# is a garbage language that wastes your time with overly verbose code that does almost nothing.

        Vector3 Norm = Recoreccting ?
        is that a conditional with ternary operators?

        Util.Vector3
        WHY?
        the docs say you define a Vector3 in C# with:
        var c = new Vector3
        vector3 has its own lerp method.

        unless Util is an object (this is why C# sucks, in gdscript I would be able to tell an object from a static class method)

        you are lerping 3 values when lerp only takes two, unless that is a custom function you made to interpolate between two vectors.

        if it's the custom function, you are ALWAYS lerping halfway though because neither Vector3 is changed and 0.5 is always 0.5.
        code does what its told to do.


        you have to either use lerp on a variable that will be changed:
        global_position = global_position.lerp(Vector3.UP, 0.5)

        or progress the interpolation amount from 0 to 1:

        var progression = 0.0
        func progress(delta : float) -> Vector3:
             progression += delta
             if progression > 1:
                  progression = 1
             return global_position.lerp(Vector3.UP, progression)

          Jesusemora 1st Yes that is a conditional ternary 2nd The reason I made the util.vector3 is to house custom functions I can use for vector3's like geting the yaw of something, 3rd you are absolutely right vector3 does have their own lerp method but it didn't work they way I needed it to work when I was doing this conditional ternary vairable thing so I thought it was broken and just made my own. people over the internet told me to use slerp so I Just used slerp with in the function along with many other stupid things. But all it does is just break my game entirely so now I'm asking for help on the normalization part of this function. 4th Util is a namespace that has classes that are just named things like Vector3 and Transform so I can know if I'm pulling functions from the right class that are made for thoes data types. And also I think you might have the solution to my problem with increasing the progression by delta time I just need to figure out how to get delta time with my function.

          • xyz replied to this.

            MrQUIVY You don't need any custom interpolation functions here. The built in ones are perfectly sufficient. The problem is not in interpolation functions themselves, it's in the way you (mis)use them.

            For interpolating between direction vectors you need to use Vector3::Slerp(). If you want the interpolation to be gradually animated throughout several frames, you need to animate either the weight argument or one of the boundary arguments. The code you've posted does neither.