Linear damping

  • Hey people, so I want to set an objects linear damping value to distance(object x,object y, mouse x, mouse y) and have the objects linear damping increase as it gets closer to the mouse but the opposite happens as linear damping relys on bigger numbers to slow the object, any way of reversing the distance output? any help is greatly appreciated

  • Please one of you awesome math experts help me

  • Set to 1 - (1/range * distance)

    If you want no damping at (range) 100 pixels. Its 1 - (1/100 * 100) = 0

    at a distance of 50 it is 1 - (1/100 * 50) = 0.5

    at zero distance it is 1 - (1/100 * 0) = 1

    This is ofcours linear.

    Most natural things are logaritmic. Or.

    1 - ((1/range)^2 * (distance)^2) (i think)

  • Set to 1 - (1/range * distance)

    If you want no damping at (range) 100 pixels. Its 1 - (1/100 * 100) = 0

    at a distance of 50 it is 1 - (1/100 * 50) = 0.5

    at zero distance it is 1 - (1/100 * 0) = 1

    This is ofcours linear.

    Most natural things are logaritmic. Or.

    1 - ((1/range)^2 * (distance)^2) (i think)

    Hi thanks for your response but it doesnt seem to be working its either setting the linear damping to 0.99... 0r just 1, is this how I was meant to implement it?

  • edit: i typed here a lot of bullshit, cuz i counted on the manual

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can reverse the damping with

    max(1000-distanceHereToThere, 0)

    Basically any distance above 1000 won't be damped, and any within 1000 will.

    With the above the damping increases linearly, but you can square it to make it increase in a more drastic way.

    max(1000-distanceHereToThere, 0)^2

  • Linear damping

    The rate the object slows down over time while moving, from 0 (no slowdown at all) to 1 (maximum slowdown)

    ?

    Max (1000 - 2000 , 0) = 0

    Max (1000 - 500 , 0) = 500 ?

    ----

    I see, manual is not correct.

  • Thank you guys for the great help, rojo your math worked a treat thanks guys

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