- Home /
Inaccurate WorldToScreenPoint
Hello everyone.
I am trying to make a web-player orthographic 2d game and ended up with a strange problem. For some reason despite both the object and the camera both starting at (0,0) my y value is incorrect. My game resolution is 795x530 yet the y value reported is 252.28. That's 12.72 off. Even more strangely, the X co-ordinate is correct.
void Update () {
Vector3 pennyVecPixtemp = Camera.main.WorldToScreenPoint(transform.position);
pennyVecPix.Set (pennyVecPixtemp.x, pennyVecPixtemp.y);
sX = Camera.main.pixelWidth;
}
Does anyone have any ideas?
I'm not sure what you mean. Surely if the object wasn't in the frustum it would have been culled and it would not be visible.
You said the camera and the object were both at (0,0) so I was guessing it was behind the near plane.
Your answer
Follow this Question
Related Questions
2D Animation does not start 1 Answer
Issue with clamping player to camera view 2 Answers
Worldtoscreenpoint..... 2 Answers
Instantiate at mouse in empty space 2D 0 Answers