Author Topic: UIDraggableCamera & SpringPosition problems  (Read 3141 times)

ejonghyuck

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
UIDraggableCamera & SpringPosition problems
« on: March 11, 2016, 05:10:03 AM »
Hey there. ;D

I am using UIDraggableCamera and SpringPosition to create a map scrolling system similar to that of Candy Crush Saga.
I found out some problems here so I want to suggest a solution to a problem and I also have some question to ask.

First, when I set worldSpace = true at SpringPosition, and whenever I get close to the target, It looks choppy and the animation did not look smooth enough.
So I examined the code again and found out that in world space it was very small distance but in local space it was not and that difference was causing the problem.
It seems that this happened because UIRoot significantly reduced the scale.
So if worldSpace = true, whenever Begin Method receives a target, transforming this value to local space and operate it on Update method in local space standard, could prevent the problem.

In addition, if I scroll the map really fast, SpringPosition.Begin method did not work properly until the camera stopped.
So I removed SpringPosition.enabled = false from UIDraggableCamera’s Update method and it started to work properly.
I want to know why this exists here.

Thanks for reading.

Ps. I am using NGUI 3.9.4.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDraggableCamera & SpringPosition problems
« Reply #1 on: March 12, 2016, 08:01:00 AM »
UIDraggableCamera is an ancient script from NGUI 1 days... at this point why it exists is anyone's guess.