Welcome,
Guest
. Please
login
or
register
.
April 29, 2026, 12:59:12 PM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Get texture's pixel coordinates when touching a UITexture?
« previous
next »
Print
Pages: [
1
]
Author
Topic: Get texture's pixel coordinates when touching a UITexture? (Read 2650 times)
Joe @ ByDesign Games
Guest
Get texture's pixel coordinates when touching a UITexture?
«
on:
June 21, 2013, 12:14:16 AM »
Have a need to get a texture's pixel coords from touching a UITexture.
Have tried a variety of approaches to no result.
Anyone know how to do this reliably?
Logged
Joe @ ByDesign Games
Guest
Re: Get texture's pixel coordinates when touching a UITexture?
«
Reply #1 on:
June 21, 2013, 02:21:47 PM »
Adding, have also tried using RaycastHit.textureCoords but that requires a mesh collider (no other collider is supported) and considering UITexture doesn't expose it's mesh, it's not working.
How else to do this?
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: Get texture's pixel coordinates when touching a UITexture?
«
Reply #2 on:
June 22, 2013, 06:07:15 AM »
Math. You know a 3D click point on the collider. Use the widget's transform.InverseTransformPoint to make it local. Divide by width/height. May or may not have to flip the Y (1 - y).
Logged
Joe @ ByDesign Games
Guest
Re: Get texture's pixel coordinates when touching a UITexture?
«
Reply #3 on:
June 22, 2013, 06:18:39 AM »
Ahh right, infer from the collision point; for some reason thought texture coords couldn't be derived that way.
Thanks Michael!
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Get texture's pixel coordinates when touching a UITexture?