playMaker

Author Topic: Touch Object Event  (Read 13550 times)

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3201
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Touch Object Event
« on: July 03, 2011, 07: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.

marcos

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 199
    • View Profile
Re: Touch Object Event
« Reply #1 on: July 03, 2011, 08:51:41 AM »
Awesome!

giyomu

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 108
    • View Profile
    • blog
Re: Touch Object Event
« Reply #2 on: July 03, 2011, 03: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 :)

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3201
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Touch Object Event
« Reply #3 on: July 04, 2011, 02: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.

rocket5

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
    • Rocket 5 Studios
Re: Touch Object Event
« Reply #4 on: August 29, 2011, 08: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)
« Last Edit: August 29, 2011, 08:50:44 PM by rocket5 »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3201
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Touch Object Event
« Reply #5 on: August 30, 2011, 07: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.

daevfinn

  • Playmaker Newbie
  • *
  • Posts: 1
    • View Profile
Re: Touch Object Event
« Reply #6 on: October 08, 2011, 02: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

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3201
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Touch Object Event
« Reply #7 on: October 08, 2011, 05: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.

zeek

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: Touch Object Event
« Reply #8 on: January 31, 2012, 07: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 :)

 
« Last Edit: January 31, 2012, 10:21:24 PM by zeek »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3201
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Touch Object Event
« Reply #9 on: February 02, 2012, 10:43:30 AM »
You got it!

To answer some questions in your video:

  • I have found that the Unity Remote can drop touch events as you're seeing. There may be remote settings that fix this, but I haven't found them. Running on the device should fix this...
  • Touch Object Event lets you target an object other than the one the FSM is on, and has some extra parameters.
  • You can use Get Touch Info to get more info about the touch.

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

Thanks,
Alex



zeek

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: Touch Object Event
« Reply #10 on: February 02, 2012, 07: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! 

fload

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Re: Touch Object Event
« Reply #11 on: July 12, 2012, 10:14:59 PM »
how would one go about dragging an object? say just on x y axis?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Touch Object Event
« Reply #12 on: July 13, 2012, 01:08:32 AM »
Hi,

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

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

fload

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Re: Touch Object Event
« Reply #13 on: July 13, 2012, 05: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=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
« Last Edit: July 13, 2012, 05:57:52 PM by fload »

ashleyajabaut

  • Playmaker Newbie
  • *
  • Posts: 1
    • View Profile
Re: Touch Object Event
« Reply #14 on: September 27, 2012, 05:29:58 AM »
Would like to know more about it, keep updating.



cosmétique oxygène