Interpolating To Mouse Position Issues

Anyone up that can help me with something really quick?

I have an object that moves left and right on the screen based on the mouse location on the viewport, it follows the mouse immediately, but I’d like it to smoothly move from where the previous mouse position was to the current mouse position, then balance itself out (wiggle?) until it tapers to a still position.

It’s only teleporting to the target location rather than interpolating…

Any ideas?

This is my current setup:

Two options that come to mind:

  1. Make the object simulate physics (maybe lock some axes depending on how it moves), and Add Force into the direction of the mouse cursor. Set linear damping to something higher than the default. Play around with values to reach the desired effect.

  2. Add another invisible component that would act as a root. Make your object simulate physics, and use a Physics constraint to connect the root and your object. Try different values in the physics constraint settings. Move the root by teleporting it to the mouse cursor position, and your object should follow it, depending on how you setup the constraint.

1 Like