# Best way to rotate a mesh "down"

My project requires me at special points to rotate some mesh (Aircraft) down - the front (nose) has to travel the shortest rotation to reach anything that will let it gain speed, so “down”.

I have no idea how would I do this, after all, it can be in any number of positions so the required rotation will most probably be a composite of multiple axes. Any good ideas/tools inside Babylon to use?

I would suggest to have your plane aligned with the z axis and y up so that you simply do plane.rotation.x = x to change its orientation.

In this case to move it in the work, you attached it to parent TransformNode (plane.parent = planeParent) and you could move the parent away

I don’t think I can get away with simple rotation in one axis in [pic] you see one of the possible scenarios where an X and Y rotation is required. I cannot just stick it to any axis unless you are suggesting some relative one I don’t understand.

Maybe this could help Mesh Rotation | Babylon.js Documentation

I’m already using local rotations to rotate my mesh in all current situations.

But for whatever reason, I’ve thought of an answer to my problem looking at this, so I will share:

I already have a method to get next point by having the old one, current rotations, and distance

Px = x0 + distance * sin(yaw) * cos(pitch)
Py = y0 + distance * sin(pitch)
Pz = z0 + distance * cos(yaw) * cos(pitch)

With this, I can get the difference between the horizontal coordinates of those 2 points and therefore get the idea of where the aircraft is pointing. After that, it’s only a matter of mixing global rotations in a good ratio.

There might be a better way but this should work