Playmaker Forum

PlayMaker Updates & Downloads => Official Action Updates => Topic started by: Alex Chouls on July 03, 2011, 10:41:00 AM

Title: Touch Object Event
Post by: Alex Chouls on July 03, 2011, 10:41:00 AM
There's a new Touch Object Event action in 1.2, but thought I'd release it early here. It lets you detect touches on an object.

In 1.1 you had to combine a few actions to achieve this, but it seems like a common enough scenario that it deserves its own action.

Please post bugs/suggestions.
Title: Re: Touch Object Event
Post by: marcos on July 03, 2011, 11:51:41 AM
Awesome!
Title: Re: Touch Object Event
Post by: giyomu on July 03, 2011, 06:11:57 PM
awesome alex, one suggestion maybe, you should add maybe an enum where we can use it over GUITextire, using the HitTest function, so then you will cover most of the scenario this can be used :)
Title: Re: Touch Object Event
Post by: Alex Chouls on July 04, 2011, 05:40:52 PM
Good idea! I think I'll make a separate action for that though since you'd want to store different results. E.g., It could store touch offsets from center or top left (your choice), making it super easy to make virtual joysticks etc.
Title: Re: Touch Object Event
Post by: rocket5 on August 29, 2011, 11:35:53 PM
Thanks for the script, but it looks like there's a bug.  If the the object with this Action is the child of another object that has a RigidBody component, the event is never passed.

Update: If I comment out the following, then the script will work correctly in the above setup:

Code: [Select]
if (hitInfo.transform.gameObject == go)
Title: Re: Touch Object Event
Post by: Alex Chouls on August 30, 2011, 10:45:36 PM
Hmmm... hadn't considered that use case.

Commenting out that line will stop all filtering by game object - probably not what you want.

Technically the child object hasn't been touched - is there some normal Unity behavior where children get events from parents (e.g. with collisions or triggers) that leads you to expect it in this case? Haven't used it myself... but this action could emulate that is the expected behavior. Alternatively I could add a "Check Parent" option...

In the meantime you could put the FSM on the game object with the collider and forward touch events to the child object using Send Event To FSM.
Title: Re: Touch Object Event
Post by: daevfinn on October 08, 2011, 05:54:51 PM
Hi I've just posted on Unity Forums this question, but my free time on the weekend to explore new techniques is drawing short and I'm hoping to find an answer while my brain is sharp.

In short, I don't see this touchObjectEvent gui.   In fact the only reason I think i see the thing named touchObjectEvent is that I added one to the Events browser but it doesn't seem to be connected to anything.

I am using Playmaker 1.2.  I'm doing work on the iPad and weekends are my only time to make some progress.  I bought Playmaker months ago and I'm just starting to wrap my head around it, so I don't know what I'm missing.

thanks

Daev
Title: Re: Touch Object Event
Post by: Alex Chouls on October 08, 2011, 08:29:25 PM
I replied on the Unity forums:

Quote
Add the Touch Object Event action and make custom events for the touch events you want to respond to.

E.g., make a "touched" event, and select it in the Touch Began dropdown. When the object is touched, the Touch Object Event action will send the touched event. Normally you would transition to another state on this event.

Basically, 1.2 doesn't have any system events for touches, you have to make custom events and use actions (like the Touch Object Event action) to send them.
Title: Re: Touch Object Event
Post by: LuminRabbit on January 31, 2012, 09:56:38 PM
Hello,

Im new to playmaker and am starting the tutorials right now :)

Would there be any chance you could do a tutorial for touch events? something simple like the other beginner tutorial changing the cube from red to green OnTouchDown and OnTouchUp from green back to red.

Quote
Add the Touch Object Event action and make custom events for the touch events you want to respond to.
E.g., make a "touched" event, and select it in the Touch Began dropdown. When the object is touched, the Touch Object Event action will send the touched event. Normally you would transition to another state on this event.

If I figure it out I'll create the Video but Im really new and just trying to figure out the functionality of Playmaker... So this post may be premature.

Im loving what Im seeing so far though... truly AMAZED!

Edit:

Ok after watching a few more of the playmaker tutorials (Great Job! by the way) I think I figured out how to do the Touch Events? Here is a quick screen recording (video) Please let me know if Im doing something wrong and if this is the correct way to do it.

http://kodagames.com/playmakerTouch.mov

I've just downloaded it almost 2 hours ago so I could be doing it wrong? Also sorry if the video screen is too larger I'll fix it later :)

 
Title: Re: Touch Object Event
Post by: Alex Chouls on February 02, 2012, 12:43:30 PM
You got it!

To answer some questions in your video:


Glad you're enjoying Playmaker! Please keep the feedback coming - let us know what we can improve.

Thanks,
Alex


Title: Re: Touch Object Event
Post by: LuminRabbit on February 02, 2012, 09:10:57 PM
Awesome!

Im glad this is the way to do it :) The reason I had asked was because I never experienced a delay like that with unity remote and scripting but never say never :)

Im happy I found Playmaker and just have to get my head around a new way of doing things. Once Im a little more comfortable I'll be sure to give more feedback... right now all I can say is EXCELLENT! 
Title: Re: Touch Object Event
Post by: fload on July 13, 2012, 01:14:59 AM
how would one go about dragging an object? say just on x y axis?
Title: Re: Touch Object Event
Post by: jeanfabre on July 13, 2012, 04:08:32 AM
Hi,

 try this:
http://hutonggames.com/playmakerforum/index.php?topic=272.0 (http://hutonggames.com/playmakerforum/index.php?topic=272.0)

http://hutonggames.com/playmakerforum/index.php?topic=270.msg1073#msg1073 (http://hutonggames.com/playmakerforum/index.php?topic=270.msg1073#msg1073)

Basically, you set to 0 the axis you don't want to drag on in the property "worldPointResult" or the property "deltaDragResult"

so if you want to drag only on the x axis, set the y axis to 0 and then inject that on the object you want to drag.

bye,

 Jean
Title: Re: Touch Object Event
Post by: fload on July 13, 2012, 08:51:41 PM
Thanks for the reply, looks like thats for mouse input im looking for touch input, (fingerDrag) any actions i can use? or does this also work on touch devices?
Hi,

 try this:
http://hutonggames.com/playmakerforum/index.php?topic=272.0 (http://hutonggames.com/playmakerforum/index.php?topic=272.0)

http://hutonggames.com/playmakerforum/index.php?topic=270.msg1073#msg1073 (http://hutonggames.com/playmakerforum/index.php?topic=270.msg1073#msg1073)

Basically, you set to 0 the axis you don't want to drag on in the property "worldPointResult" or the property "deltaDragResult"

so if you want to drag only on the x axis, set the y axis to 0 and then inject that on the object you want to drag.

bye,

 Jean

EDIT: NVRMIND I didnt read enough...thanks again
Title: Re: Touch Object Event
Post by: ashleyajabaut on September 27, 2012, 08:29:58 AM
Would like to know more about it, keep updating.



cosmétique oxygène (http://www.karinherzog.com/fr/)
Title: Re: Touch Object Event[SOLVED]
Post by: 4ppleseed on October 24, 2013, 08:01:44 AM
How is it possible to store the touched object as a variable? Wouldn't that be a logical addition to this? Thanks.
Title: Re: Touch Object Event
Post by: jeanfabre on October 30, 2013, 01:28:27 AM
Hi,

 This action targets a specific object, so you only receives events on that object. Does that make sense? You define in the first place what object to listen too.

bye,

 Jean
Title: Re: Touch Object Event
Post by: 4ppleseed on November 04, 2013, 04:13:34 PM
Hi,

 This action targets a specific object, so you only receives events on that object. Does that make sense? You define in the first place what object to listen too.

bye,

 Jean


Ahh yes, I see what you mean now :D