playMaker

Author Topic: Stucked with virtual controls  (Read 1942 times)

xevious

  • Playmaker Newbie
  • *
  • Posts: 5
Stucked with virtual controls
« on: June 12, 2017, 02:37:39 PM »
Hi, sorry for my faulty english...

I've recently bought Playmaker and I'm amazed of its ease of use. However, I'm stucked into a problem.

I am using a sample from ecosystem of a virtual stick that is working fine, but I want to tune it a little bit. I want the stick to appear when I put my finger on the screen, so I have used get touch info, create an object action and set parent actions to put the recently created stick as a child inside a main canvas object.

It's actually working, the virtual GUI stick appears when I put my finger on the screen, but is not reacting unless I raise my finger and touch the stick again. Since I really want the stick to be destroyed when I raise the finger isn't working well for me.

I don't know if I'm explaining right the issue, is there any way that I can force the detection of the stick when is created under your finger in runtime?

I really appreciate your help


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Stucked with virtual controls
« Reply #1 on: June 12, 2017, 11:28:52 PM »
Hi,
You should not use Create and destroy for this, it is cpu heavy and you get a lot of garbage.

You could use Activate/deactivate game object.

But in this case i might use 'alpha's' to fade in/out images from the controller

So in the sample you should use "U Gui Graphic Set Color" and only set the alpha, all other should be 'none'
and on both 'ui joystics' you need to set the color from 'Background' and 'Thumb Graphic'

The alpha you can set between 0 and 1

xevious

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Stucked with virtual controls
« Reply #2 on: June 13, 2017, 05:56:05 AM »
So I assume if the stick is deactivated/activated instead of created on runtime will detect the contact of the finger when appears?

Thanks for your quick response! I'll definitely try this.  :)

xevious

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Stucked with virtual controls
« Reply #3 on: June 13, 2017, 06:19:08 AM »
I have done it activating/deactivating game object, but it stills doesn't detect i'm touching the virtual stick, as it appears under my finger.

If I drag my finger out of the area of the stick without releasing it from the screen, and touch the stick with another finger then it reacts.

Is there any way to force the detection of my finger when it appears the virtual stick under it?


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Stucked with virtual controls
« Reply #4 on: June 13, 2017, 08:06:37 AM »
Yes, that's why i said that it might be better using alpha's (to make the stick invisible) :)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Stucked with virtual controls
« Reply #5 on: June 13, 2017, 11:53:16 AM »
I made a quick sample on the original sample which will hide the stick on the left side
It will show on pointer down and it will center on the position from the stick to where you pressed. (only on the left part of the screen)

You can look to the colored states on the left controller fsm, it will show what i did.

You need to get the original 'u Gui Joystick' 1st from the Ecosystem and then install this one.

And just to be sure Always make a backup 1st before you install something! :)
« Last Edit: June 13, 2017, 08:58:09 PM by djaydino »

xevious

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Stucked with virtual controls
« Reply #6 on: June 13, 2017, 03:50:49 PM »
I previously did what you told me, with the stick always active and playing with u gui alpha values, but still wasn't working well, the stick was recognized if I touched the same position than the previous touch (I suppose It's because the stick was hidden due to alpha, but in the right position).

Now with your version it's working fine!
Although 1 of 10 times I touch the screen it doesn't recognize the touch, but I'm sure It's my fault... I'll check my states again to see what I can find, I'm still a playmaker newbie...

Thank you very much djaydino, you helped me a lot! :D .

PD I'm, a 3D artist so my programming skills aren't fine... don't hesitate to ask me if there's anything I can help you with

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Stucked with virtual controls
« Reply #7 on: June 14, 2017, 12:26:45 AM »
Hi,
Quote
(I suppose It's because the stick was hidden due to alpha, but in the right position).
alpha only makes images transparant, but the interaction stays the same,
the reason might be that you are touching outside 'Thumb Interactive' image box.
if you select the 'Thumb Interactive' from the right stick,
you can see on the scene view that the size is just around the stick.
when you select 'Thumb Interactive' from the left stick,
you can see that it takes almost the whole left side of the screen.

But it also might be that you use a different resolution, so i adjusted the left joystick panel so it should always cover the whole left screen.

I have updated the file so that it works now out of the box (you don't need to get the original 1st now and because there where some links broken for the input data.

You can find many tutorials on the user tutorial wiki page

Thanks for the offer, maybe i could use some assets for my tutorial videos.
I also started a patreon page where you can find preview tutorials like this one.
Feel free to become a member and support me there.

xevious

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Stucked with virtual controls
« Reply #8 on: June 14, 2017, 11:19:50 AM »
It works like a charm now! touch issues are gone now, works flawlessly.

thank you so much, you've been a lifesaver!