Align arc rotate camera to rotated plane normal?

Hello,

I’m trying to learn how I can move an arc rotate camera to align perpendicularly to a rotated plane normal.

https://www.babylonjs-playground.com/#Y6W087#150

Something like:

camera → | Rotated Mesh Plane

I’ve tried to calculate the angles between the plane face and camera direction but never seem to get the correct result after the transformation. Guessing I’ve taken a wrong turn somewhere?

I’ve added a playground above. Thanks in advance for any help/guidance :slight_smile:

Here’s something that works to some point:

https://www.babylonjs-playground.com/#Y6W087#151

It works if you move separately the x/y rotation and keep the other one to 0, but you get a rotation around Z if you give some value to both. I don’t know how to get rid of this rotation around Z and even if it is possible, as it is a degree of freedom that you have because you only take into account the normal of the plane. Maybe there is something to do with the camera.upVector but I don’t know what…

3 Likes

Thanks, @Evgeni_Popov

That’s great, strange the effect with Z when you apply X/Y. I’ll keep running with your approach to see if I can find anything with the camera.

Thanks for all of your help :slight_smile:

Thanks for the solution keep supporting