I am making an application and encountered an intereseting problem.
In my application I would like to have some actors to maintain their screne size whenever the perspective camera gets further away / closer to them. Since I am also running collision checks with the said actors, I am unable to create that effect using an orthographic camera.
What I would need is some sort of formula which takes into account camera paramaters (fov, screen size) and the actor’s distance from the camera, and returns a scalar which can be multiplied with the actor’s scale, such that it maintains the same screen size whenever the camera moves.
I suspect the solution involves pretty basic trigonometry, but I wasn’t able to figure it out myself.
Any help in the form of a blueprint script or C++ code would be much appreciated!
Edit : I forgot to stress that my application involves changing the screen size and field of view, so simply scaling the actor lineraly based on its distance from the camera would not be sufficent.