Author Topic: Radial scrollview  (Read 2277 times)

yo_milo

  • Newbie
  • *
  • Thank You
  • -Given: 10
  • -Receive: 2
  • Posts: 36
    • View Profile
Radial scrollview
« on: April 27, 2015, 12:29:11 PM »
Hello, I am trying to do a Radial Scrollview...

I know codewise, what to do to position my buttons (objects.transform.localPosition = new Vector3( distanceToCenter * Mathf.Cos(i * angleBetweenObjects), distanceToCenter * Mathf.Sin( i * angleBetweenObjects)); ) , and how to keep my buttons always pointing up (inverting the localeuler angle of the parent); however, I want to implement it as a scroll view... or at least be able to use the gesture recognition available in the scroll view...

How should I approach this? (I am reading scroll view class at the moment).

Is it more advisable to create a new class that inherits scroll view?
Create a copy of scroll view and create my new class based on that (I think not)
Or modify scrollview?

EDIT:
So far, the greatest contenders for movement are MoveAbsolute and MoveRelative, I am going to experiment a little bit.
« Last Edit: April 27, 2015, 12:47:33 PM by yo_milo »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Radial scrollview
« Reply #1 on: April 27, 2015, 04:46:50 PM »
The scroll view was written to move items up or down, not circular... so for something circular I am not sure what to suggest. I probably wouldn't use the UIScrollView. I'd set up a panel set to use a texture mask for clipping, then I'd put an invisible widget covering it (probably with UIWidget.hitCheck set to a custom function to do hit testing so it's not square). With this invisible widget I'd put a collider on it so it responds to events, and a script that would perform the dragging of items logic. The items itself would be children of the radially clipped panel, and this script would control how they move.

yo_milo

  • Newbie
  • *
  • Thank You
  • -Given: 10
  • -Receive: 2
  • Posts: 36
    • View Profile
Re: Radial scrollview
« Reply #2 on: April 28, 2015, 10:39:12 AM »
What I ended up doing was creating a clip area.
Then I created a Widget container where all my sprites are anchored.
That container has a script that sets the sprites in position based on distance to center, and number of sprites in the container.
It also sets the inside objects z rotation to the negative z rotation of that widget.

Then I used a modified version dragObject to do the main widget rotation...

It was a quick solution for a demo, once I have a solution that nicely integrates with NGUI, I will share it.

SpiritOpportunity

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Radial scrollview
« Reply #3 on: July 19, 2015, 10:10:03 PM »
It was a quick solution for a demo, once I have a solution that nicely integrates with NGUI, I will share it.

Is this available now?