playMaker

Author Topic: Virtual Joystick Ecosystem Sample [ECOSYSTEM] [JULY 2019]  (Read 17532 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Virtual Joystick Ecosystem Sample [ECOSYSTEM] [JULY 2019]
« on: July 30, 2015, 02:03:25 AM »
Hi Everyone,

 A New sample is available on the Ecosystem, this time showing how to build a Virtual Joystick with just the new Unity UI and PlayMaker, so you get a complete solution that you can then further improve/modify to your needs, but as is it will be already pretty solid.



You can download it manually here

Bye,

 Jean
« Last Edit: July 15, 2019, 03:39:44 AM by jeanfabre »

clandestine

  • Sr. Member
  • ****
  • Posts: 255
    • ЯKD.ZONE
Re: Virtual Joystick Ecosystem Sample
« Reply #1 on: July 30, 2015, 07:02:08 AM »
This is awesome man, wow!!!
U4.6 and up right?

A million thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Virtual Joystick Ecosystem Sample
« Reply #2 on: July 30, 2015, 07:08:08 AM »
Hi

 yes, 4.6+ and 5 ( not tested on 5, but should work, it's simple a simple UI rig after all).

Bye,

 Jean

ETGgames

  • Junior Playmaker
  • **
  • Posts: 56
    • ETGgames
Re: Virtual Joystick Ecosystem Sample
« Reply #3 on: August 01, 2015, 03:34:25 PM »
how come the fsm has no actions in its state? I only see events in the events tab...theres nothing.. any possibility you can show us how to set this thing up? I just want to get it to the state u showed in the screenshot - right now i can drop an invisible prefab onto the scene and literally thats it. Perhaps include a sample scene? Thanks
« Last Edit: August 01, 2015, 03:48:43 PM by ETGgames »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Virtual Joystick Ecosystem Sample
« Reply #4 on: August 01, 2015, 04:13:27 PM »
Hi,
That fsm is just there to work with the ugui system you can just ignore that object/fsm
but do not disable or remove.

ETGgames

  • Junior Playmaker
  • **
  • Posts: 56
    • ETGgames
Re: Virtual Joystick Ecosystem Sample
« Reply #5 on: August 02, 2015, 04:01:08 AM »
So how do I actually get the joysticks? there is no joystick prefab - do I have to download something additionally? I just want to have what jean showed in his screenshot. Thanks

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Virtual Joystick Ecosystem Sample
« Reply #6 on: August 02, 2015, 04:13:16 AM »
Hi,

 There is a prefab, it's in the custom sample folder next to the sceneit's called "UI Joystick".

 When you deal with Unity UI, everything has to be within a Canvas, so go explore the content of the canvas and you'll find what you see on screen. you'll find the left josytick in Canvas/Left Joystick Panel/UI Joystick

The other option is to select from the scene view the element you want to look at.

I am also confused by your statement, have you loaded the scene uGuiJoystick? Is it working when you press play? do you see the joysticks and the feedback as you drag the joysticks around?

Bye,

 Jean

ETGgames

  • Junior Playmaker
  • **
  • Posts: 56
    • ETGgames
Re: Virtual Joystick Ecosystem Sample
« Reply #7 on: August 02, 2015, 04:54:52 AM »
Ah, I see, I was just having difficulty finding the uGUI Joystick scene - you made it clear now. Thanks. Two quick questions: can I use both joysticks at the same time if on a mobile device, and why did u use unity 4.6 not 5 to make this? thanks
« Last Edit: August 02, 2015, 06:08:22 AM by ETGgames »

smartgames

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Virtual Joystick Ecosystem Sample
« Reply #8 on: August 02, 2015, 06:04:16 AM »
Hi,

 There is a prefab, it's in the custom sample folder next to the sceneit's called "UI Joystick".

 When you deal with Unity UI, everything has to be within a Canvas, so go explore the content of the canvas and you'll find what you see on screen. you'll find the left josytick in Canvas/Left Joystick Panel/UI Joystick

The other option is to select from the scene view the element you want to look at.

I am also confused by your statement, have you loaded the scene uGuiJoystick? Is it working when you press play? do you see the joysticks and the feedback as you drag the joysticks around?

Bye,

 Jean
i want to know how to assign this controller to the player object i want to move ?
i downloaded the joystick and tried it but i dont know how to deal with the object i want to move ?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Virtual Joystick Ecosystem Sample
« Reply #9 on: August 02, 2015, 06:06:04 AM »
Hi,

yes, the examples compile on mobile, I tested it. basically you can have as many joysticks you want on screen, they will work as expected ( they rely under the hood with the Unity event systenm so you are safe).

 I always try to make samples with the lowest Unity version so that everyone benefits from it, If I make it for u5, u4 users would not be able to use it, and it allows users to report any issues with new releases, and then I modify the content to work across the board.

 Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Virtual Joystick Ecosystem Sample
« Reply #10 on: August 02, 2015, 06:07:53 AM »
Hi,

 either you modify the prefab so that it talks to the player, or you do the opposite, your player go get the input on the joystick. Check the panel that displays the infos for both joystick, they use "Get Fsm float" action, targeting the joystick and track the input they want. Do the same.

Bye,

 Jean


ETGgames

  • Junior Playmaker
  • **
  • Posts: 56
    • ETGgames
Re: Virtual Joystick Ecosystem Sample
« Reply #11 on: August 02, 2015, 06:12:16 AM »
ok but what action would you actually use do the movement? I have a cube set up with get fsm float of the x and y values, I just don't know what action should be used to convert the joystick input values to movement. Could you tell me how to get a simple rigid body cube to move using the joystick. Thanks
« Last Edit: August 02, 2015, 04:34:33 PM by ETGgames »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Virtual Joystick Ecosystem Sample
« Reply #12 on: August 03, 2015, 04:52:51 AM »
Hi,

You should use this input value coming from the joystick like the regular Unity Input.

Simply use a translate action, in the value of the translation use the input value multiplied by a speed float, and make the translation works per seconds.


 Bye,

 Jean

ETGgames

  • Junior Playmaker
  • **
  • Posts: 56
    • ETGgames
Re: Virtual Joystick Ecosystem Sample
« Reply #13 on: August 03, 2015, 06:14:18 AM »
I think I'm not understanding you, which input value should I be using? Ive attached a screenshot to show the fsm I set up on the cube. I use a get fsm float for x and y values and save them as float variables, then multiply it by 5, then use translate x with the x float variable and translate z with the y float variable. It doesn't look like the cube is picking up the input from the joysticks. Its really weird all the logic looks like it should be working. I've even tested the cube to make sure translate works, I've tried putting the cube in and out of the canvas in the hierarchy, I've even tried making the x and y variables of the joystick globals and then directly access the globals from the cube using the translate, and I've tried using set velocity, controller move, and of course translate. None of these seem to work, so its definitely a problem with the cube not picking up the input.
« Last Edit: August 03, 2015, 07:58:15 AM by ETGgames »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Virtual Joystick Ecosystem Sample
« Reply #14 on: August 03, 2015, 02:54:16 PM »
Hi,

 The bottom is missing so I can't see if you are properly setting up the translate.

 Bye,

 Jean