Thanks, thats the exact same math nightmare I ran into when trying to solve this lol.
I did find a solution, it was “hidden” in the Content Examples project (of course ):
It’s deep within the Math_Hall level (3rd to last demo 2.20), name of the material is “M_Camera_Vector_to_Object”.
Here’s the material for it, hooks right up to WPO:
Note: I don’t know what the unconnected 1,1,0 vector multiplied by ThirdOrthogonal Vector3 does or where it goes, but I left it in for completeness.
Info:
-
To see it update in editor, I had to change the Actor Position node to a Object Position node.
-
Width and Height control the scale of the object that the material is applied to.
-
To make it scale from the center, subtract 0.5 from TexCoord of Y axis.
-
To control scale with Transform > Scale in the editor, multiply width by ObjectScale > X, multiply height by ObjectScale > Y (or Z).