hi all, i was woundering if there is a way to active a gui object (like a button) when my character get close to it and deactivates when he is far and WITHOUT using colliders (they are just messy and difficult to use, they'll be my last resort).
My game is a space so it has to be able to go everywhere aswell
here is a copy of my GUI code:
Thank you in advance, Lachee
asked Nov 18 '10 at 04:40 AM
Use the Pythagorean theorem: SqRoot[(x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2]. This gives you the distance between 2 points in 3D-Space. If dist < trigger radius, then activate button. You might not want to do this every frame... but if you do it every half-second/quarter-second or so it won't affect your frame-rate that much...