i am trying to make labels for my objects in the scene. obviously i dont know how to properly convert world to screen coords, they seem to rotate around 3d space but they shouldnt
here is the code i use:
i know this code isnt good, it was just for testing. i want line to go from the middle of the object (that is targetPosition Vector3) and other point should be, let's say 1 point long left or right from the object position, it should just project to the screen, not in 3D space
EDIT: i tried this, but it didnt get me too far (i used origin variable):
i simply dont get this.. :( what i am trying to do is to do labels for my objects in the scene. first step would be to get the position of the object and draw the line from that point and point that is offset a little. that worked fine if i used for example
but it rotated in 3d space so my guess was that i need to project the offset point to viewport of screen space, but every combination i tried didnt work...it is so frustrating...
if i use WorldToScreenPoint i get huge numbers for origin.ToString() so i am using WorldToViewportPoint... this seems to be so simple, but i cant get it to work
You declared the "origin" variable but you're not doing anything with it.
answered Jul 01 '10 at 08:24 PM