playMaker

Author Topic: Touch Controls in Playmaker - help needed!  (Read 3575 times)

SamH

  • Playmaker Newbie
  • *
  • Posts: 41
Touch Controls in Playmaker - help needed!
« on: May 14, 2020, 12:15:11 PM »
Hi all, does anyone have any solid experience implementing touch controls with playmaker? I'm very familiar with playmaker but touch controls are new to me.
I feel like I just need to get off the ground with the basics and then I can take it from there. I'd be willing to pay for someones time if you'd be interested in an hour or two of assistance!

I only need to learn the basics:
-pinch to zoom (specifically being able to zoom accurately in on the pinch points)
-Touch and drag to navigate around a 2d screen
-Making camera movements hit defined screen boundaries (whether dragging or pinch zooming)

Currently I have basic taps working (as the mouse click commands translate easily to touch controls and are thus also easy to test in game view via mouse clicks).
I also have a few custom actions like 'Camera Pinch Zoom' and 'Drag Camera' which functionally do what I want but I haven't been able to make them feel responsive the way touch needs to be.
I also bought EasyTouch5 which has playmaker support, but with their forums down I've struggled to make progress there.

I'm sure that with some initial assistance I'll pick this up quickly! Please let me know if anyone can help me out!

Sam
« Last Edit: May 17, 2020, 05:51:48 PM by SamH »

ch1ky3n

  • Full Member
  • ***
  • Posts: 208
Re: Touch Controls in Playmaker - help
« Reply #1 on: May 15, 2020, 06:03:44 AM »
try this
https://assetstore.unity.com/packages/tools/input-management/lean-touch-30111
it's free and if you like it and want more example you can get the + version.

Plus the owner is super friendly too

SamH

  • Playmaker Newbie
  • *
  • Posts: 41
Re: Touch Controls in Playmaker - help
« Reply #2 on: May 16, 2020, 01:53:21 PM »
A friend also recommended lean touch, sounds like a good package. But do you know if it integrates with playmaker?

Maddy

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Touch Controls in Playmaker - help
« Reply #3 on: May 17, 2020, 06:40:03 AM »
Sam, I've just got Lean Touch and been in contact with the creator, Carlos, a really helpful guy, as I'm looking for about the same thing as you. I also need pinch /zoom and drag with boundary.

He suggested Lean Touch GUI, but that doesn't work quite for what I needed. Although I will need both Lean Touch and LT GUI for other things.

He did say that he might be able to make a component for what I need. Probably to add it to LT+. The other two assets I mentioned are free. Maybe you can try those and see if they would work and suit your project?

We might need exactly the same thing, so then he'll have two people to do this for.

There are no PM actions but it works.

I'm an artist with poor memory and brain fog trying to make a game. Please wish me luck! :-D

SamH

  • Playmaker Newbie
  • *
  • Posts: 41
Re: Touch Controls in Playmaker - help
« Reply #4 on: May 17, 2020, 10:44:56 AM »
Sounds great! I'll buy it today and start playing around with it. And I'm sure theres a large community of playmaker users who would jump at something like this too if it ended up getting playmaker action support! 
Please let me know how you get on with it :)

Maddy

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Touch Controls in Playmaker - help needed!
« Reply #5 on: May 18, 2020, 12:52:07 AM »
Sure I'll let you know how I get on with Lean Touch +  :D if Carlos can add the component, I really hope so.

Please let us /me know how you get on  :)
I'm an artist with poor memory and brain fog trying to make a game. Please wish me luck! :-D

Maddy

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Touch Controls in Playmaker - help needed!
« Reply #6 on: May 18, 2020, 01:30:31 PM »
Sam, there will be an update with a new component in Lean Touch+, maybe later this week or so. Carlos was nice enough to give me some scripts that I needed for this to work and it works perfectly and now I've purchased LT+.
I'm an artist with poor memory and brain fog trying to make a game. Please wish me luck! :-D

SamH

  • Playmaker Newbie
  • *
  • Posts: 41
Re: Touch Controls in Playmaker - help needed!
« Reply #7 on: May 19, 2020, 05:22:18 PM »
So after playing around with LeanTouch+ I can confirm that it is a really good package for quickly implementing responsive touch features. It doesn't have direct playmaker actions, but because it has a host of inbuilt components that take care of all the common touch input needs (without any scripting or coding needed), for the most part I didn't actually need a lot of interaction with playmaker.
And because playmaker is able to access the 'get/set properties' of the LeanTouch components, you can control LeanTouch using playmaker where needed.

I got my drag camera navigation & pinch to zoom stuff all working within a few minutes. And just about got my screen edge limits working with their 'constrain' component.

So for anyone like me, who is unable to script and is unfamiliar with touch controls, I can highly recommend this. Thanks to those who suggested it.
« Last Edit: May 20, 2020, 04:51:01 PM by SamH »

SamH

  • Playmaker Newbie
  • *
  • Posts: 41
Re: Touch Controls in Playmaker - help needed!
« Reply #8 on: May 19, 2020, 05:23:03 PM »
@Maddy-  Out of curiosity what was the custom component you needed?

Maddy

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Touch Controls in Playmaker - help needed!
« Reply #9 on: May 20, 2020, 05:00:23 AM »
Sam, I think the extra script was LeanConstrainToOrthographic which is added to the Camera, along with Pinch and Drag.

I created a GO, called it Boundary, added a Lean Plane component and filled in the max and minimum values.

Under Main Camera - LeanConstrainToOrthographic I selected the GO Boundary with the Lean Plane script.

There will probably be an example scene, I suppose, as there are soooo many examples scenes in the LT assets.

Where did you find the Screen Edge Limits? I've purchased LT+ but I'm waiting for the update to import the whole asset.
I'm an artist with poor memory and brain fog trying to make a game. Please wish me luck! :-D

SamH

  • Playmaker Newbie
  • *
  • Posts: 41
Re: Touch Controls in Playmaker - help needed!
« Reply #10 on: May 20, 2020, 04:44:23 PM »
Ah cool ok, the screen constraint was the last element which I needed to improve on. I got it mostly working- I used a Constrain to Collider and I created a cube which sits around my camera (but as I'm using an orthographic camera its really only the X sides of the cube which are relavent). The camera moves freely but stops when it collides with the edges of the cube (which I scaled to a size which meant the camera frame was at the edge of screen).
The complication is that the camera can also pinch to zoom. And if you are zoomed out, then the outer boundaries of the constraint mean the cameras wider field of view can see off screen. ie the constraints are on the cameras tranlation, not its field of view.
So I did a play maker state machine which on every frame scales my cubes size relative to the orthographic zoom size (using a simple formula). So no matter what zoom I am at, the cube will be at a size that stops the camera before its FOV is off screen.
But as I said its not perfect.. generally it feels like a bit of a hack and I'm sure if they're writing a specific component for use with orthographic cameras it will be far superior to my solution!

Maddy

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Touch Controls in Playmaker - help needed!
« Reply #11 on: May 23, 2020, 08:40:25 AM »
Hope you get it working well, Sam!
I'm an artist with poor memory and brain fog trying to make a game. Please wish me luck! :-D