0 Favourites

How do I ease parameter value?

  • I have an object that looks at my cursor direction in Mouse.X and Mouse.Y position. But currently it's way too fast, so I want to ease it a bit. Any idea how do I apply an "easing" effect to the MouseX and MouseY value?

    Note: as this object is interacting within a plugin I cannot apply an easing behavior to the object, I need to ease the parameter.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Try lerping. lerp(a, b, x) Linear interpolation of a to b by x. Calculates a + x * (b - a).

    So a is your starting point, b is your target, and x is the amount between the two values (0-1 scale)

    For your case, object.angle is a, angle(object.x,object.y,mouse.x,mouse.y) is b, and you can choose anything between 0 and 1 which determines how much you want to move towards the target every tick.

    Note that this will never actually reach your target value unless you round() the value. And even then only when your c value is more than 0.5.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)