I’ve been struggling with this one a while… I’m trying to retrieve the relative position of an object within the rendered image.
(I’m transferring pivot data into rendered Sprites in Unity3D. The renders are done with an orthographic camera)
I’ve been getting mixed values with my attempts. Has anyone had any better luck at something like this? Added bonus if it handles camera shifting as well.
I used to do this with perspective (and not for export) trough another method.
However, here it is:
This function has 2 issues afaics:
it rather takes the sensor into account, not the resolution (so y = x or so)
seams that the shift goes back in ortho so u need to compensate by - 2*shift
Here’s a workin example, with respective code:
(I use Animation Nodes for convenience, so that I skip to the essential part of the script. So you will need that if you wanna get into the file.
Maybe u don’t it, though in the example it also generates the list of positions by that loop and writes to a txt)