maath icon indicating copy to clipboard operation
maath copied to clipboard

damp3 and easing function

Open tommhuth opened this issue 2 years ago • 2 comments

I'm trying to use the easeInOutCubic function from easings.net but that does not seem to work as the object just teleports to its destination

function easeInOutCubic(x: number): number { 
    return x < 0.5 ? 4 * x * x * x : 1 - Math.pow(-2 * x + 2, 3) / 2;
}

damp3(ref.current.position, p.current, 5, delta, 2, easeInOutCubic)

Changing smoothTime, lowering eps or maxSpeed does not seem to have any effect. What exactly does easing expect? When I try out the included rsqw there is a marginal improvement, with the object teleporting to its target with only a couple of frames in between. When console.loging the t param, it does not seem to follow the typical 0-1 range.

tommhuth avatar Apr 04 '23 22:04 tommhuth

Hey I'm facing the same issue. Did you find any solution?

deepansh96 avatar Sep 06 '24 11:09 deepansh96

I also have this problem - there is no easing, doing it like this:

   // in the render loop here values for x/y/z are changing
   const deltaTime = clock.getDelta();
   dummyMesh.position.set(x, y, z);
   easing.damp3(nose.position, dummyMesh.position, 0.00025, deltaTime);

Tried manually putting an array in place of the dummyMesh.position as in the example here: https://github.com/pmndrs/maath/blob/main/README.md

Im find that quaternion easing is working fine using easing.dampQ in the same file

amcc avatar Nov 16 '24 21:11 amcc