|
I'm wondering how to tell where the furthest left and "top" screen coordinates of an object is. I had thought to use the transform.collider.min and doing worldtoscreenpoint, but as the camera rotates around the object (especially around the x axis) this doesn't always hold up. Thanks!
(comments are locked)
|
|
I'm afraid there's no easy solution for this. You could go over all the points of your collider, calculate screencoords and calculate min/max values on them. Yeah, that sounds painful. If it can't be done, it can't be done though. Maybe I'll add a comment about this in the GUI thread at http://feedback.unity3d.com.
Jun 20 '10 at 04:55 PM
Adamv
(comments are locked)
|
|
If you still havent found an easier solution for this, here is my complicated and not very accurate solution. This is the function you need for getting an objects PIXEL SIZE (size drawn on screen)
Where diam is, diam = transform.collider.bounds.extents.magnitude; dist is, dist = Vector3.Distance (transform.position, Camera.main.transform.position); cam is the camera you are using. This works for square or circular objects best. Then you can work your way through objects screen position and the objects screen size to find your answer. Regards, Aubergine
(comments are locked)
|
