playMaker

Author Topic: HELP! Smooth Mouse Follow with example  (Read 2770 times)

boxels

  • Playmaker Newbie
  • *
  • Posts: 3
HELP! Smooth Mouse Follow with example
« on: January 21, 2017, 02:57:17 PM »
Hi, new to playmaker have tried for a few days to find how to do the following without success:

Example:

Deeeep.io
In this webGL game the character/player always points towards the mouse cursor and moves in that direction smoothly. If the mouse goes over the character/player, it stops moving.
 
How do we get this using Playmaker actions? I've tried the available EcoSystem action "Follow Mouse" but it does not work.

Here is what I get with the Follow Mouse action on ecosystem:

Here is my setup (FSM):
« Last Edit: January 21, 2017, 03:08:52 PM by boxels »

marv

  • Junior Playmaker
  • **
  • Posts: 50
Re: HELP! Smooth Mouse Follow with example
« Reply #1 on: January 23, 2017, 05:27:10 AM »
Heya,

I've only experimented with this a bit but since I don't need it for my project I didn't get far into it, so I can't tell you exactly what you need/what's wrong.

However, I think the follow mouse action is not what you'd want for character movement like in Deeeep.io, because when working correctly it doesn't make the object move towards the pointer but makes it mimic the pointer movement.

For the kind of movement you are trying to achieve you'll have to go with a more complex setup. I'm just taking a quick glance at my actionsbrowser/ecosystem here... as I said, I've never directly worked with this, so I can only give a rough starting point.^^

I'd try for a "get mouse position" action in combination with a "look at direction" to make it look at the pointer and then work with "set velocity" to make it move...

Hope this somewhat helps.
« Last Edit: January 23, 2017, 12:24:50 PM by marv »

boxels

  • Playmaker Newbie
  • *
  • Posts: 3
Re: HELP! Smooth Mouse Follow with example
« Reply #2 on: January 23, 2017, 11:54:25 AM »
Thank you! That is a great idea I will try this week and return and report. I appreciate the though you gave this!

boxels

  • Playmaker Newbie
  • *
  • Posts: 3
Re: HELP! Smooth Mouse Follow with example
« Reply #3 on: January 23, 2017, 05:16:43 PM »
The two FSMs that did the trick were as follows,

  • Get Mouse Position Advanced (ecosystem)
  • Look at 2D (ecosystem)


Rotation Offset is 90 degrees.

Now to have it actually move on the map, but stay in the center of the screen.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: HELP! Smooth Mouse Follow with example
« Reply #4 on: January 24, 2017, 01:55:34 AM »
Hi,

 for staying centered, you'll have to have the camera following your character, have you experimented with this already?

 Bye,

 Jean