playMaker

Author Topic: How to move object to mouse smoothly  (Read 988 times)

andri1305

  • Playmaker Newbie
  • *
  • Posts: 9
How to move object to mouse smoothly
« on: February 08, 2020, 08:34:36 AM »
I'm creating a card game and I need to move to card to the mouse smoothly, in like a certain amount of time. But just making it follow the mouse, it teleports to the mouse since it's pivot point is int the middle, and starts following, but I want it to go that locked point in like 1 second, while the mouse is moving.
Follow mouse is what I'm using for the card/object to stay on mouse, but I need to get the card smoothly to the mouse. I've tried "Move Object" to an object that follows the mouse, it goes to the point where the object was when clicked and then teleports to follow the mouse. Tried both "Move Towards" and "Move Towards Advanced" and both take years to reach to reach the mouse and then even more to slowly go to the pivot point to finish moving and lock on the mouse.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to move object to mouse smoothly
« Reply #1 on: February 12, 2020, 01:52:33 AM »
Hi,

 you need to record the offset between the mouse position and the card pivot when you start dragging, then when you move you keep applying that offset as you drag, during the drag you tween the offset back to 0 over a certain duration.

Bye,

 Jean