Align Objects to Viewport through Rotation


Hey i encountered a tricky problem i batch render some Objects and would like them to get rendered from there frontside (They are one sided and positioned randomly). I implemented my batch render and so on but i kind of stuck with the Rotation of my Objects. Right now i align them and i have Splines going from the center of my viewport to different Faces of the Object.

The Idear: I have the Splines from my View Center to the faces of the Object. So i could check __ length mySline and compare them. But how exactly can i rotate my Object (in which space ) so that it will come closer to even out the different lenghts. I thought about using RayMeshGridIntersect too. ANy typs how to approach would be appreciated


you can align the object’s local z axis to the viewport using this
$.rotation = getViewTM()


Thank u :slight_smile: