Hello Guest

Author Topic: How do you do contining raycast?  (Read 3232 times)

happy123

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 12
    • View Profile
How do you do contining raycast?
« on: November 02, 2013, 06:01:12 pm »
I have a grid of 9 x 9 UIItems that I want to select bad on my input position (both mouse and touch) such as:

1. When I pressed down on the first UIItem, it records that item
2. Without releasing my finger or mouse, I move until I am above another UIItem
3. Once I relase my finger or mouse, the selection is over

I want to know exactly how to do so.  I am reading Hover, but its confusing.  Specifically this part: Hover needs to be enabled to work (Hover actived(tk2dUIManager.areHoverEventsTracked), using a mouse and mult-touch is disabled.  While you have a property IsOver that tracks if a mouse is over the UIItem. 

Here are what I think needs to happen:
* IsHoverEventsEnabled needs to be check for each UIItem
* AreHoverEventsTracked needs to be check in UIManager
* Does not work with mouse, only with touch (?)

The final product will be for mobile, but I need to test with a mouse on the editor. Can you shed some light?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: How do you do contining raycast?
« Reply #1 on: November 02, 2013, 10:05:57 pm »
You'll have to code this yourself. tk2d doesn't support hover as you're describing it right now. Hover only works as mouse hover right now. You can use ray casts to find intersections if you want to do it yourself.

happy123

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: How do you do contining raycast?
« Reply #2 on: November 03, 2013, 04:40:09 am »
Okay, I think I got it.  The function I was looking for is in UIManager.cs => RaycastForUIItem().