Welcome,
Guest
. Please
login
or
register
.
October 01, 2025, 12:50:41 PM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Getting UI Dragable to snap to grid(like)
« previous
next »
Print
Pages: [
1
]
Author
Topic: Getting UI Dragable to snap to grid(like) (Read 2025 times)
RandomGuy
Guest
Getting UI Dragable to snap to grid(like)
«
on:
January 09, 2013, 07:03:12 AM »
Is their anyway to get the UI Dragable script to get objects to snap to like a grid, and if I could make a grid that turns off and on that would be great to .
Logged
dlewis
Guest
Re: Getting UI Dragable to snap to grid(like)
«
Reply #1 on:
January 09, 2013, 07:46:48 AM »
Have you seen the CenterOnChild sscript? It's used in one of the examples.
Logged
RandomGuy
Guest
Re: Getting UI Dragable to snap to grid(like)
«
Reply #2 on:
January 12, 2013, 12:16:03 PM »
Just made my own script , call it whenever you need to snap to a solid 10 divisible number
public
void
SnapIT
(
)
{
//Math.Round(3.44, 1); //Returns 3.4. // its not that C# is better, but the documentation deffinitly is .
Vector3 Temp
=
this
.
transform
.
localPosition
;
float
tempX
=
Mathf
.
Round
(
Temp
.
x
/
10
)
;
float
tempY
=
Mathf
.
Round
(
Temp
.
y
/
10
)
;
float
tempZ
=
Mathf
.
Round
(
Temp
.
z
/
10
)
;
NewPos
=
new
Vector3
(
tempX
*
10
, tempY
*
10
,tempZ
*
10
)
;
this
.
transform
.
localPosition
=
NewPos
;
}
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Getting UI Dragable to snap to grid(like)