playMaker

Author Topic: Input touches for playmaker package available  (Read 29729 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Input touches for playmaker package available
« on: July 23, 2012, 10:35:14 AM »
Hi,

 Ok, I decided to release what I had so far. It's pretty much final, but of course will need testing and likely improvement in some areas.

 so grab the package here:
https://hutonggames.fogbugz.com/default.asp?W961

all comments, suggestions and critics are welcome so that working with Input touches is convenient.


1: Add the "gesture" prefab from Input Touches package and set it the way you need it ( default is fine to start with)
2: go to the menu action"PlayMaker Add ons -> Input touches -> components ->Add proxy to scene"
 This will add a "PlayMakerInputTouchesProxy" prefab.
3: select that "PlayMakerInputTouchesProxy" and check the touches types you want to have in that scene
4: in your Fsm, implement one of the custom events "INPUT TOUCHES" that you need and you will get it fired when appropriate


To get information from the touch, a series of actions it there. you can access the last event fired, so them actions are best put on the state that implement a global variable related to Inpout touches.


All questions and comment welcome of course.

I have yet figured out how to expose multi finger positions, but that's already advanced, I might user arrayMaker, but not sure how just yet. that's be on the next iteration of that proxy.

 Bye,

 Jean

derkoi

  • Full Member
  • ***
  • Posts: 187
Re: Input touches for playmaker package available
« Reply #1 on: July 25, 2012, 08:22:00 AM »
Thanks Jean  :)

atmuc

  • Playmaker Newbie
  • *
  • Posts: 26
Re: Input touches for playmaker package available
« Reply #2 on: November 19, 2012, 02:12:15 PM »
i imported the latest versions. At unity 4 i get this error;

/Assets/PlayMaker Input Touches/Internal/PlayMakerInputTouchesProxy.cs(50,50): Error CS0123: A method or delegate `PlayMakerInputTouchesProxy.OnPinch(float)' parameters do not match delegate `Gesture.PinchHandler(PinchInfo)' parameters (CS0123) (Assembly-CSharp)

if (_isPinch)
         {
            Gesture.onPinchE += OnPinch;
         }

i think input touches api changed.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Input touches for playmaker package available
« Reply #3 on: November 20, 2012, 02:39:15 AM »
Hi,

 Thanks for the findings, will get in touch with the guy and update the action.

bye,

 Jean

atmuc

  • Playmaker Newbie
  • *
  • Posts: 26
Re: Input touches for playmaker package available
« Reply #4 on: November 20, 2012, 02:27:06 PM »
i changed 2 methods. it works now.

Code: [Select]
void OnRotate (RotateInfo  RI)
{
var magnitude = RI.magnitude;
if (debug) {
Debug.Log ("rotate " + magnitude);
}

LastEventMagnitude = magnitude;

PlayMakerFSM.BroadcastEvent ("INPUT TOUCHES / ROTATE");
}

void OnPinch (PinchInfo PI)
{
var magnitude = PI.magnitude;

if (debug) {
Debug.Log ("pinch " + magnitude);
}

LastEventMagnitude = magnitude;

PlayMakerFSM.BroadcastEvent ("INPUT TOUCHES / PINCH");
}

gamedivision

  • Full Member
  • ***
  • Posts: 227
Re: Input touches for playmaker package available
« Reply #5 on: January 07, 2013, 09:17:32 AM »
ive just bought this and got the same fault where do i change the methods

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Input touches for playmaker package available
« Reply #6 on: January 07, 2013, 09:25:33 AM »
Hi,

 You  should change this in line 536-567 of script PlayMakerTouchesProxy ( likely, I don't have yet the pacakge)

 else, simply double click on the error log and it will take you to the faulty line, which will indicate you where to do them changes.


bye,

 Jean

gamedivision

  • Full Member
  • ***
  • Posts: 227
Re: Input touches for playmaker package available
« Reply #7 on: January 07, 2013, 10:27:50 AM »
Don't know if this is relevant to the problem but the dev posted this on his profile page

Added JS counterpart to all the C# examples
Added isFlick variable to DragInfo, indicate if it's a (very) short drag
Pinch Event now pass PinchInfo which include the magnitude of the pinch as well as the finger's position.
Pinch Event now pass RotateInfo which include the magnitude of the rotation as well as the finger's position.

gamedivision

  • Full Member
  • ***
  • Posts: 227
Re: Input touches for playmaker package available
« Reply #8 on: January 07, 2013, 01:09:41 PM »
i get these faults after changing the code
/Assets/PlayMaker Input Touches/Internal/PlayMakerInputTouchesProxy.cs(176,56): Error CS0103: The name 'OnCharging' does not exist in the current context

/Assets/PlayMaker Input Touches/Internal/PlayMakerInputTouchesProxy.cs(180,56): Error CS0103: The name 'OnCharging' does not exist in the current context

i commented them out and it runs but im sure im not meant to

Hi,

 You  should change this in line 536-567 of script PlayMakerTouchesProxy ( likely, I don't have yet the pacakge)

 else, simply double click on the error log and it will take you to the faulty line, which will indicate you where to do them changes.


bye,

 Jean

gamedivision

  • Full Member
  • ***
  • Posts: 227
Re: Input touches for playmaker package available
« Reply #9 on: January 07, 2013, 05:52:39 PM »
i found this on the BasicDetector script,and was wondering if we could expose the touch info then i could store that in a vertor 3
Code: [Select]
using UnityEngine;
using System.Collections;

public class BasicDetector : MonoBehaviour {

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update(){
if(Input.touchCount>0){
foreach(Touch touch in Input.touches){
if(touch.phase==TouchPhase.Began) Gesture.OnTouchDown(touch.position);
else if(touch.phase==TouchPhase.Ended) Gesture.OnTouchUp(touch.position);
else Gesture.OnTouch(touch.position);
}
}
else if(Input.touchCount==0){
if(Input.GetMouseButtonDown(0)) Gesture.OnMouse1Down(Input.mousePosition);
else if(Input.GetMouseButtonUp(0)) Gesture.OnMouse1Up(Input.mousePosition);
else if(Input.GetMouseButton(0)) Gesture.OnMouse1(Input.mousePosition);

if(Input.GetMouseButtonDown(2)) Gesture.OnMouse2Down(Input.mousePosition);
else if(Input.GetMouseButtonUp(2)) Gesture.OnMouse2Up(Input.mousePosition);
else if(Input.GetMouseButton(2)) Gesture.OnMouse2(Input.mousePosition);
}
}

}

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Input touches for playmaker package available
« Reply #10 on: January 08, 2013, 03:22:54 PM »
Hi,

 ok, new update on the wiki page:
https://hutonggames.fogbugz.com/default.asp?W961

 it's now compatible with the latest version of Input.Touches available on the asset store.

Touch info are exposed already, you can use any of the actions provided to access particular touches. For taps, there is: https://hutonggames.fogbugz.com/default.asp?W981

Now, it's true that positions are exposed as Vector2, not Vector3. Nevermind, I did an action for this :)
http://hutonggames.com/playmakerforum/index.php?topic=2894.0

bye,

 Jean

gamedivision

  • Full Member
  • ***
  • Posts: 227
Re: Input touches for playmaker package available
« Reply #11 on: January 08, 2013, 04:32:12 PM »
thank you jean i dont know what we'd do without you.
heres my issue at the moment,of getting the finger position and storing it in a vector3,the gestures are no good for storing finger position when down.i tried dragging the PlayMakerInputTouchesProxy and using the get property for the raw touches but the only variable i can use with that is a bool,so ive ended up using a get touch info
is there a way of getting the finger position using the playmakerinputtouches or shall i just use the playmaker actions to store that finger position


thank you

Hi,

 ok, new update on the wiki page:
https://hutonggames.fogbugz.com/default.asp?W961

 it's now compatible with the latest version of Input.Touches available on the asset store.

Touch info are exposed already, you can use any of the actions provided to access particular touches. For taps, there is: https://hutonggames.fogbugz.com/default.asp?W981

Now, it's true that positions are exposed as Vector2, not Vector3. Nevermind, I did an action for this :)
http://hutonggames.com/playmakerforum/index.php?topic=2894.0

bye,

 Jean


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Input touches for playmaker package available
« Reply #12 on: January 09, 2013, 03:22:21 AM »
Hi,

 I am not really following your problem. Can you clarify? if you want to store raw finger pos with Input.Touches, enable the "on" feature in PlayMakerInputTouchesProxy and you will get the raw touch position using "InputTouchesGetPosition"

 Else, yes of course you can combine official touch actions from playmaker if you find it easier.

bye,

 Jean

gamedivision

  • Full Member
  • ***
  • Posts: 227
Re: Input touches for playmaker package available
« Reply #13 on: January 09, 2013, 05:42:00 AM »
That's weird because I did that and nothing showed up in the get position,I'll try again

Thank you

gamedivision

  • Full Member
  • ***
  • Posts: 227
Re: Input touches for playmaker package available
« Reply #14 on: January 09, 2013, 09:47:17 AM »
i dropped in the PlayMakerInputTouchesProxy i ticked the Down,On,Up from the raw touches i then created an empty game object added an FSM,added Input Touches Get Position stored that in a vector 2 ran it on unity remote on my iPad, doesn't log any touches at all no numbers show in that vector2

Hi,

 I am not really following your problem. Can you clarify? if you want to store raw finger pos with Input.Touches, enable the "on" feature in PlayMakerInputTouchesProxy and you will get the raw touch position using "InputTouchesGetPosition"

 Else, yes of course you can combine official touch actions from playmaker if you find it easier.

bye,

 Jean