Wednesday, 15 June 2011

unity3d - How do I know coordinates of both ends of cylinder -



unity3d - How do I know coordinates of both ends of cylinder -

i want show text top of cylinder

how know coordinates of both ends of cylinder?

the standart unity cylinder 2 units talls (when local scale 1). top end y+1 , bottom y-1.

c# code top , bottom points:

vector3 mycylindertopspot = cylinder.transform.position + (new vector3(0, 1, 0) * cylinder.transform.localscale.y); //cylinder type gameobject

vector3 mycylinderbottomspot = cylinder.transform.position + (new vector3(0, -1, 0) * cylinder.transform.localscale.y);

unity3d

No comments:

Post a Comment