Playmaker Forum
PlayMaker Updates & Downloads => Share New Actions => Topic started 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
-
Thanks Jean :)
-
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.
-
Hi,
Thanks for the findings, will get in touch with the guy and update the action.
bye,
Jean
-
i changed 2 methods. it works now.
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");
}
-
ive just bought this and got the same fault where do i change the methods
-
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
-
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.
-
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
-
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
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);
}
}
}
-
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
-
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
-
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
-
That's weird because I did that and nothing showed up in the get position,I'll try again
Thank you
-
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
-
Think I've sorted it,I didn't realise you had to run a global event as well
-
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
-
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
-
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
-
(http://img708.imageshack.us/img708/4715/touchinfo.jpg)
-
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
-
its not moving within the camera space,when i move my finger around the ipad screen its way off the camera view
-
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
-
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
-
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
-
Hi,
here we go:
http://hutonggames.com/playmakerforum/index.php?topic=2921.0 (http://hutonggames.com/playmakerforum/index.php?topic=2921.0)
bye,
Jean
-
Wow thank you jean can't wait to finish work and check it out ;D
-
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)
-
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
-
- 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)
-
Hi,
that's really odd... let me run some tests, I'll get back to you on this.
bye,
Jean
-
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.
-
Hi,
What version of Unity are you using?
What version of Input.touches are you using?
I can't repro unfortunatly.
bye,
Jean
-
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
-
Updated and found them events! Thanks! Whoop whoop!
-
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
-
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
-
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?
-
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?
-
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
-
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;
}
-
Hi,
what version of Input Touches are you using?
Bye,
Jean
-
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!
-
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
-
Hey there, Jean! I certainly appreciate it!!!
-
Any update on this? I'd certainly appreciate it!
-
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!