Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: jeanfabre on July 23, 2012, 10:35:14 AM

Title: Input touches for playmaker package available
Post by: jeanfabre 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 (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
Title: Re: Input touches for playmaker package available
Post by: derkoi on July 25, 2012, 08:22:00 AM
Thanks Jean  :)
Title: Re: Input touches for playmaker package available
Post by: atmuc 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.
Title: Re: Input touches for playmaker package available
Post by: jeanfabre 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
Title: Re: Input touches for playmaker package available
Post by: atmuc 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");
}
Title: Re: Input touches for playmaker package available
Post by: gamedivision on January 07, 2013, 09:17:32 AM
ive just bought this and got the same fault where do i change the methods
Title: Re: Input touches for playmaker package available
Post by: jeanfabre 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
Title: Re: Input touches for playmaker package available
Post by: gamedivision 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.
Title: Re: Input touches for playmaker package available
Post by: gamedivision 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
Title: Re: Input touches for playmaker package available
Post by: gamedivision 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);
}
}

}
Title: Re: Input touches for playmaker package available
Post by: jeanfabre 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
Title: Re: Input touches for playmaker package available
Post by: gamedivision 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

Title: Re: Input touches for playmaker package available
Post by: jeanfabre 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
Title: Re: Input touches for playmaker package available
Post by: gamedivision 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
Title: Re: Input touches for playmaker package available
Post by: gamedivision 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
Title: Re: Input touches for playmaker package available
Post by: gamedivision on January 09, 2013, 10:45:03 AM
Think I've sorted it,I didn't realise you had to run a global event as well
Title: Re: Input touches for playmaker package available
Post by: jeanfabre on January 09, 2013, 01:45:28 PM
Hi,

 It definitly works here, I think you misunderstand the use of them action. They use the last recorded gesture, or tap, which means it only make sense to use these actions when a Input touch event has been fired.

Create a state with a global transition set to "INPUT TOUCHES / ON" in that state, use the action "Input Touches Get Position" and make sure you have ticked "on" in the bridge. That will be working then.

This bridge is working using event data, so events fired by this playmaker bridge carry in a way the information, only that it's not stored in the event data itself but inside the bridge, but the principle is there.

So following this principle, it's always important to get the information you want from a particular event as soon as you receive it, else another event might be fired that will overwrite the data.

bye,

 Jean

 bye,

 Jean

 
Title: Re: Input touches for playmaker package available
Post by: gamedivision on January 09, 2013, 02:11:46 PM
yeah i hadn't created the event,
now i created the event and it stores the touch position in a vector 2 using Input Touches Get Position,
then on another FSM i have the Vector2 to Vector3 then a set position using the converted vector 3 but for some strange reason my touch is off the screen
Title: Re: Input touches for playmaker package available
Post by: jeanfabre on January 09, 2013, 02:21:37 PM
hi,

 Position in space are not position in 2d screens, it's a different "world" all together. The only way to match screen pos and world pos, is either to fit the world units necessary to cover the screensize in the camera field of view. so for ipad if you have 1024 pixel in width, you need to have your camera to view at least 1024 unit in width.

 else, you need to work it out using my action that transform a screen position onto a plane in the 3d world, ( search for "drag" on this forum, lot'ss of example on how to convert a screen pos into a world pos.

bye,

 Jean
Title: Re: Input touches for playmaker package available
Post by: gamedivision on January 09, 2013, 02:22:05 PM
(http://img708.imageshack.us/img708/4715/touchinfo.jpg)
Title: Re: Input touches for playmaker package available
Post by: jeanfabre on January 09, 2013, 02:33:29 PM
Hi,

 Couls you explain what we should look for?

what do you want to do with the touch position? that's the question I guess.

bye,

 Jean
Title: Re: Input touches for playmaker package available
Post by: gamedivision on January 09, 2013, 02:35:09 PM
its not moving within the camera space,when i move my finger around the ipad screen its way off the camera view
Title: Re: Input touches for playmaker package available
Post by: jeanfabre on January 09, 2013, 02:40:14 PM
Hi,

 yes, but what do you want to do with the touch position? do you want to drag something around in the world? do you want to have a gui texture or a 2d element following the touch?

bye,

 Jean
Title: Re: Input touches for playmaker package available
Post by: gamedivision on January 09, 2013, 03:44:39 PM
no its going to be used for slashing objects,I'm going to add a ray cast on finger down that follows the finger position,then detect when the ray cast hits an object,which will set off the slice of that object
Title: Re: Input touches for playmaker package available
Post by: jeanfabre on January 10, 2013, 03:19:45 AM
Hi,

 Yes in your case, you will need a special custom action to ray cast from a screen pos. the drag system I did will not do that as is.

 Get back to me in few days if you haven't heard back from me.

bye,

 Jean
Title: Re: Input touches for playmaker package available
Post by: jeanfabre on January 11, 2013, 02:01:20 AM
Hi,

 here we go:

http://hutonggames.com/playmakerforum/index.php?topic=2921.0 (http://hutonggames.com/playmakerforum/index.php?topic=2921.0)

bye,

 Jean
Title: Re: Input touches for playmaker package available
Post by: gamedivision on January 11, 2013, 04:15:46 AM
Wow thank you jean can't wait to finish work and check it out  ;D
Title: Re: Input touches for playmaker package available
Post by: Martin on February 27, 2013, 12:23:23 PM
Input Touches 'Down', 'On' , 'Up' does not appear in the events menu. Are they supported?

- Unity 4.0.1f2
- Playmaker  1.5.3
- Input.Touches 1.1.3
- Playmaker Input Touches (https://hutonggames.fogbugz.com/default.asp?W961 (https://hutonggames.fogbugz.com/default.asp?W961))

I tried with a new project only importing Playmaker and Input Touches, same issue.

(http://i.imgur.com/LU2nbd9.png)
Title: Re: Input touches for playmaker package available
Post by: jeanfabre on February 28, 2013, 02:12:53 AM
Hi,

Can you double check something:

1: instead of choosing "custom events" go to the "global events", and there you should have it listed. The "custom events" I think only list the one used or something.

2: if (1) doesn't work:

 go to the "PlayMakerInputTouchesProxy" gameObject that should be in your scene as a prefab.

 go to the event tab.

do you see "INPUT TOUCHES / ON" and the one that are missing? if yes are they ticked as global? if not, then tick them on.

bye,

 Jean
Title: Re: Input touches for playmaker package available
Post by: Martin on February 28, 2013, 11:18:06 AM
- Only 'Down' is listed in the the Global Event menu.

- 'Down', 'On' , 'Up' are not listed in the events of the "PlayMakerInputTouchesProxy" gameObject.

(http://i.imgur.com/V2wskkB.jpg)(http://i.imgur.com/uxQNCt5.jpg)
Title: Re: Input touches for playmaker package available
Post by: jeanfabre on March 01, 2013, 12:48:08 AM
Hi,

 that's really odd... let me run some tests, I'll get back to you on this.

bye,

 Jean
Title: Re: Input touches for playmaker package available
Post by: Sonic Punch Studio on April 01, 2013, 12:29:42 AM
Any news on the missing global events? I've just gotten Input.Touches and also missing Input Touches / On and others listed as missing in this thread.
Title: Re: Input touches for playmaker package available
Post by: jeanfabre on April 01, 2013, 05:38:00 AM
Hi,

What version of Unity are you using?
What version of Input.touches are you using?

I can't repro unfortunatly.

bye,

 Jean
Title: Re: Input touches for playmaker package available
Post by: jeanfabre on April 01, 2013, 05:59:23 AM
Hi,

 I did repro! I have update the package, tell me if that works better now.

Download the package from here again:

https://hutonggames.fogbugz.com/default.asp?W961


bye,

 Jean
Title: Re: Input touches for playmaker package available
Post by: Sonic Punch Studio on April 02, 2013, 11:21:40 PM
Updated and found them events! Thanks! Whoop whoop!
Title: Re: Input touches for playmaker package available
Post by: JustDave on July 18, 2013, 04:21:59 PM
Unity version 4.1.5f1
PlayMaker version 1.6.2
Input Touches version 1.1.3f1
PlayMaker Input Touches - downloaded today from website - version unknown


I'm encountering a weird problem with Playmaker Input Touches.

I have a button that switches (Load Level) between scenes using the SHORT TAP and a Playmaker FSM.  When I go to a new scene the number of tap events sent from the PlayMakerInputTouchesProxy increases by 1 (1,2,3,4,etc) each time I go to another scene (seen via the "tap * 1 debug message).  I attached a script to the button that detects the tap (sample from Input Touches) and it only ever acknowledges a single tap, like it should. In the PlayMakerInputTouchesProxy, I only have "Tap" enabled.  I'm not sure what is happening but it causes things to work incorrectly.

Any advice is appreciated!

Thank you,
Dave

Title: Re: Input touches for playmaker package available
Post by: jeanfabre on July 28, 2013, 12:38:52 PM
Hi,

 are you properly carrying over the various prefabs required for input touche and playmaker bridge? it's likely that it gets resetted maybe. You should make them so that they don't get destroyed on load. have you tried that?

bye,

 Jean
Title: Re: Input touches for playmaker package available
Post by: frozze on August 14, 2014, 04:26:21 PM
Sorry for bringing this old post to life again, but I have some questions.
In the "DragCameraWithLimits" example:

1. Instead of moving the camera left and right, how can I just move the cube so the camera is not moving?
2. I've changed the movement from x to y, but when I have to move the cursor horizontal in order to move the cube vertical, how do I change that?
Title: Re: Input touches for playmaker package available
Post by: dubnug on September 07, 2014, 09:29:17 PM
I'm using Input.Touches & Playmaker, and am trying to do a simple on Pinch function (to zoom in and out, with a gameobject at the center of the axis).

I feel pretty silly, but I'm not exactly sure how to implement something like that. Jean, is there a chance you'd be willing to help guide me through that, or do you have an example scene for that?
Title: Re: Input touches for playmaker package available
Post by: jeanfabre on December 12, 2014, 02:40:47 AM
Hi,

 Version 1.2 is now supported, please download from the wiki page (https://hutonggames.fogbugz.com/default.asp?W961).


@Dubnug

Stay tune, and please bump me regularly, I am in the mood for screencasts :) and I'll cover your request.

https://trello.com/c/PzJ2flRB/22-input-touches

please up vote to show interest.

 Bye,

 Jean
 Bye,

 Jean
Title: Re: Input touches for playmaker package available
Post by: petelachatte on May 26, 2015, 03:43:04 PM
Hi,

Sorry to wake this topic up; but i cannot make it work ...

I get a null reference to instance exception int the following code:

The proxy prefab is on the scene; can you please give me some help ?

Thanks

---

public override void OnEnter()
      {
         startPoint.Value = PlayMakerInputTouchesProxy.LastSwipeInfo.startPoint;
         endPoint.Value = PlayMakerInputTouchesProxy.LastSwipeInfo.endPoint;
         direction.Value = PlayMakerInputTouchesProxy.LastSwipeInfo.direction;
         angle.Value = PlayMakerInputTouchesProxy.LastSwipeInfo.angle;
         duration.Value = PlayMakerInputTouchesProxy.LastSwipeInfo.duration;
         speed.Value = PlayMakerInputTouchesProxy.LastSwipeInfo.speed;
         isMouse.Value = PlayMakerInputTouchesProxy.LastSwipeInfo.isMouse;
         index.Value = PlayMakerInputTouchesProxy.LastSwipeInfo.index;
      }
Title: Re: Input touches for playmaker package available
Post by: jeanfabre on May 27, 2015, 02:26:35 AM
Hi,

 what version of Input Touches are you using?

 Bye,

 Jean
Title: Re: Input touches for playmaker package available
Post by: joel.carlson on October 07, 2015, 01:45:32 PM
Hey there, Jean!

I've absolutely LOVED using input.touches! I have one request. Any chance to get actions for diagonal movements? Top/Right, Top/Left, Bottom/Right, Bottom/Left? Or any idea how I would do that? I'm making an isometric game (think Pac-Man 256), and those actions would be invaluable!

Thanks so much for all your hard work in making Playmaker SO awesome!
Title: Re: Input touches for playmaker package available
Post by: jeanfabre on October 08, 2015, 08:29:32 AM
Hi,

I have something around that to adapt for Input.touches. Can you get back to me mid next week? and I'll upgrade the package.

 Bye,

 Jean
Title: Re: Input touches for playmaker package available
Post by: joel.carlson on October 14, 2015, 12:21:00 PM
Hey there, Jean! I certainly appreciate it!!!
Title: Re: Input touches for playmaker package available
Post by: joel.carlson on October 21, 2015, 12:31:05 AM
Any update on this? I'd certainly appreciate it!
Title: Re: Input touches for playmaker package available
Post by: joel.carlson on October 26, 2015, 01:18:49 PM
Alright, I think I figured out the solution. I mucked with the values on InputTouchesProxy file and changed the angles to my 'new' up/down/left/right. Things seem to be working well now!