playMaker

Author Topic: Touch events, and separating logic.  (Read 2492 times)

DIamod

  • Playmaker Newbie
  • *
  • Posts: 17
Touch events, and separating logic.
« on: April 12, 2019, 03:36:18 PM »
Hi, I have been looking at youtube videos for the past few days and I am a bit stuck on both touch and understanding how to separate the logic from the rest of the gameplay.

My touch controls look as follows
https://i.imgur.com/YeBuu9R.png

I got this from a YouTube video that I have not been able to relocate. My first question is should the sensitivity be as high as it is? when I am using the unity remote I can watch the FSM and see it constantly jump between the "Touching" and "Moving" states, it is very sensitive and takes a lot of control for it to think that my finger is stationary.

My next question is regarding separating out the logic, I have this FSM set in an empty object called "TouchControls" I am unsure how to interact with that in my "CharacterMovement" object.

I tried adding touch_began as a global transition as shown in the following image, but it never seems to start with that even, even though I believe the content is set up correctly.
https://i.imgur.com/6BfOr0q.png

Advice on how I am setting this up and separating out the game logic would be helpful.

Thanks.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Touch events, and separating logic.
« Reply #1 on: April 13, 2019, 10:02:11 AM »
Hi.

I am not sure why its not working, but i would highly recommend to use a touch asset like (for example) Easy touch 5

search for 'Touch playmaker' on the asset store to see which asset are available.

DIamod

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Touch events, and separating logic.
« Reply #2 on: April 13, 2019, 10:37:02 AM »
Thanks, I will grab easy touch and see if it works. Is my understanding of global variable correct and what I had should have worked?

Just tried to access their website for some documentation but it seems to be down http://www.thehedgehogteam.com/Forum/ are you aware of any guides for this?

I found a french youtube guide but its not very complete. I should have checked for the forum and support before I purchased, as soon as I press play my console fills with errors such as

Code: [Select]
NullReferenceException: Object reference not set to an instance of an object
HutongGames.PlayMaker.Actions.EasyTouchQuickTap.OnUpdate () (at Assets/EasyTouchAddon4PlayMaker/Actions/Event/EasyTouchQuickTap.cs:25)
HutongGames.PlayMaker.FsmState.OnUpdate () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:265)
HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2782)
HutongGames.PlayMaker.Fsm.Update () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1994)
PlayMakerFSM.Update () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:579)
« Last Edit: April 13, 2019, 11:11:12 AM by DIamod »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Touch events, and separating logic.
« Reply #3 on: April 14, 2019, 05:47:51 AM »
Hi.
Sorry for this.
I checked the review on easy touch and their latest update.
I can see on the reviews that many others also have the same issue.
It seems that the author has abandonment the asset, last update was in October 2018 and their forum is offline.

I think best is to send a mail directly to them with this issue and also ask a refund.

if they do not reply you can contact unity :
https://support.unity3d.com/hc/en-us/articles/205060439-How-do-I-request-a-refund-on-an-asset-

i am not sure what asset is best to use, it has been a while that i used touch control.

Before i have been using input.touches but it seems that this one is also abandoned.

DIamod

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Touch events, and separating logic.
« Reply #4 on: April 14, 2019, 01:00:28 PM »
Thanks for the advice, I will send them an email and see what happens.

SamH

  • Playmaker Newbie
  • *
  • Posts: 41
Re: Touch events, and separating logic.
« Reply #5 on: May 10, 2020, 04:04:10 PM »
Hi there! Just wondering what your resolution was here? Are you still using EasyTouch? Or did you find something better?

Im just getting started with touch controls and only really need to learn the basics (pinch to zoom, pinch to zoom to the area thats being pinch, tapping a button, dragging the screen (camera pan).  Any assistance or suggestions of how to get started would be very appreciated!

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Re: Touch events, and separating logic.
« Reply #6 on: May 10, 2020, 07:52:31 PM »
@Dlamod

Here is a series of video that discuss touch input (I believe you are talking about video 08-Touch Event) https://www.youtube.com/playlist?list=PLD8AAC983AAD87D01

I'm using the device simulator which is from Unity's Package Manager for touch input (though you don't have to) and just did a test to see if its possible to separate the logic from touch controls and this seems to work for me (please see attached image), when the screen is touched, the Touch Event in State 1 fires the Rotate event of state 2 (in here I can put rotation etc..) In Events the checkbox next to my Rotate event is checked.

If you wanted it to go back to the start state when touch ended I would change the START event name to another global event name for example "Begin" this way you can go back and forth between the 2 states.

Hope this helps?
« Last Edit: May 10, 2020, 08:09:02 PM by Kodagames »
Have I said how much I love playmaker!!! This is one amazing tool