Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: dreamt1204@hotmail.com on October 16, 2017, 09:08:35 AM

Title: Circular bound for UIdragObject?
Post by: dreamt1204@hotmail.com on October 16, 2017, 09:08:35 AM
Hello~

How do I make a circular bound for my UIdragObject?
I found the option in inspector using Content Rect or Panel. But how do I restrict UIdragObject movement in a circular area?

If this is not possible... any quick and easy way I can make a dynamic joystick for my game?

I will be super appreciate with any help :)
Title: Re: Circular bound for UIdragObject?
Post by: ArenMook on October 19, 2017, 02:30:52 AM
You'll need to write some code for that. Create a copy of the UIDragObject script, or edit the existing one.

Personally I wouldn't use it for an on-screen joystick. I'd write a custom script for it, as a joystick also needs to spring back to the center when released.

Something like this would be trivial to do -- custom script with an OnDrag function that moves some target sprite, keeping it within X distance of the desired center. When released, snap or SpringLerp back to center.