Author Topic: Dragging off an object.  (Read 4316 times)

AlexEvangelou

  • Guest
Dragging off an object.
« on: December 06, 2012, 03:47:55 PM »
This is the behavior I'm looking for:

1. Press down on button (OnPress(true) fires and I store it in some variable)
2. While button is pressed something happens on update (Ship fires or something)
3. Mouse/Finger is dragged off the button but still held down.
4. Need some sort of notification of this so the event can stop happening.

Also touching off a button and dragging onto it doesn't click the button.

It seems like in the mobile case this would be what OnHover should turn into OnOver basically. But this isn't the case. This seems like functionality any GUI would have in the mobile space.

JRoch

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 140
    • View Profile
Re: Dragging off an object.
« Reply #1 on: December 06, 2012, 04:55:41 PM »
On mobile, where there is no hover, you should be able to just use .lasthit, which should be null if no collider is under the press, and the gameobject of the collider if there is.  That's just a hint to get you started.  Aren will probably provide a much more elegant suggestion.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dragging off an object.
« Reply #2 on: December 06, 2012, 05:07:53 PM »
2.2.7 already has an option to do this. Just wait for an update. Pro users have it, but it will be a bit before I release it for standard users.
« Last Edit: December 07, 2012, 06:48:29 AM by ArenMook »

AlexEvangelou

  • Guest
Re: Dragging off an object.
« Reply #3 on: December 06, 2012, 07:20:04 PM »
I'm guessing it's safe to assume you mean 2.2.7 right?

Looking here: http://www.tasharen.com/forum/index.php?topic=2416.msg12024#msg12024

If I'm reading it right, you're saying that when dragging you would receive an OnPress(false) call when you drag off the object if stickyPress is enabled? Sounds exactly like what I'm looking for, I'll have to wait.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dragging off an object.
« Reply #4 on: December 07, 2012, 06:48:41 AM »
Yes I meant 2.2.7, sorry.