- Home /
Screen to world point - parented camera
I have a TextMesh object that i want to always be a certain position on my screen (to align to a guiTexture aligned using pixel coordinates). This TextMesh is part of a prefab and is parented to an object (the object is at 0,0,0). I want to use screenToWorld point form this camera (which can rotate in all axis) and center this text mesh over a guiTexture.
Here are images of my prefab hierarchy, and my camera hierarchy and the posiiton that is returned from screenToWorldPoint(which is far from the camera).
So you have GameObject root.
Camera is a child of root. Test$$anonymous$$esh is a child of root.
When you update Text$$anonymous$$esh's position, the position of camera changes? Is that the problem?
Or, does ScreenToWorldPoint give you a weird result?
ScreenToWorldPoint gives an odd result. It is close, but it seems to be not centered. And don't want to add a "correction value" as thats bad program$$anonymous$$g practice. I feed in the position of the yellow progress bar guiTexture, and then it makes my object center in the screen, not the position on screen i want. If you need more information just ask, but im up for any oddities or common mistakes that can happen with using this method that i am unaware of that somebody else may be.
Your answer
Follow this Question
Related Questions
Direct positioning with a perspective camera? 2 Answers
How to keep the same position of the object instead of camera 0 Answers
camera and positiong problems 1 Answer
Align TextMesh on Top Right 1 Answer