playMaker

Author Topic: Plugin\Fsm(link) to control Mouse movement on Mobile [SOLVED]  (Read 3375 times)

san_san

  • Playmaker Newbie
  • *
  • Posts: 27
Can i emulate Mouse X Axis input on Android in Playmaker?

Find asset for playmaker for similar purposes:

http://www.pepwuper.com/touch-to-mouse-input-converter-for-playmaker-on-unity-3d-unity3d-gamedev/

If you are using PlayMaker plugin for Unity3D and are struggling with touch input in your game built with mouse events, I made a FSM to convert touch input into mouse input in my project so that it will work on my Mac and iPhone at the same time. Just drop the prefab into your scene, or create a GameObject, add FSM, and paste the template in the .asset file.

Basically, when a user touches the screen (Touch Began), this FSM will send a MOUSE DOWN event to the object touched, and send a MOUSE UP event to the object touched when the user lifts his/her finger (Touch Ended).
« Last Edit: May 31, 2016, 01:35:00 AM by san_san »

Captaincrud

  • Junior Playmaker
  • **
  • Posts: 72
Re: Plugin\Fsm(link) to control Mouse movement on Mobile
« Reply #1 on: May 28, 2016, 03:31:39 PM »

san_san

  • Playmaker Newbie
  • *
  • Posts: 27
Re: Plugin\Fsm(link) to control Mouse movement on Mobile
« Reply #2 on: May 29, 2016, 01:45:37 AM »
* GetAxis
* GetAxisVector
* GetButton
* GetButtonDown
* GetButtonUp
As i know this functions already in Playmaker?

I need to on touch object event send:
1. Set Animator Float Horizontal Axis X =1, to move player
2. AND Set Mouse Axis X = 1 to rotate player

Goal is to move player and rotate at the same time to simplify controls on mobile.

PlaymakerNOOB

  • Full Member
  • ***
  • Posts: 219
Re: Plugin\Fsm(link) to control Mouse movement on Mobile
« Reply #3 on: May 29, 2016, 12:04:39 PM »
there is no need to emulate mouse on android.  I believe all of the mouse events now work on mobile since at least unity4.  The problem with using mouse, is that any additional touch beyond the first one, will cause issues with your input system.


* GetButton
* GetButtonDown
* GetButtonUp

Using Touch Event, Touch GUI Event, or Touch Object Event combined with finger IDs, will accomplish the same in a single action.

Keep in mind that finger ID's start at 0 for the first touch.  So if you currently have 3 fingers touching, you will have:
Finger ID's 0,1,2 to choose from when you want to get information about them.


1. Set Animator Float Horizontal Axis X =1, to move player
2. AND Set Mouse Axis X = 1 to rotate player

Use Get Touch Info, to get information from the touches.  It should be the same process as your current mouse actions.

san_san

  • Playmaker Newbie
  • *
  • Posts: 27
Re: Plugin\Fsm(link) to control Mouse movement on Mobile
« Reply #4 on: May 30, 2016, 02:12:56 AM »
Thanks for detailed reply, can't figure out how to make it with finger id but get and idea of very easy solution.
Control over Mouse look:

1. Set Mouse Sensitivity to = 0
2. Control Over Min and Max Axis X with Float variable
3. Input Mouse X axis in Manager - Only Mouse

3. On Touching Right arrow:
3.2. Set Mouse Sensitivity to = 0.2
3.3. Add Float +0.8 to Min and Max, per frame for smooth rotation

4. Same for left arrow, just use Float substract