Find the X / Y / Z rotation angles from one position to another

I use a 3D engine called Electro , which is programmed using Lua. This is not a very good 3D engine, but I have no choice in this matter.

Anyway, I'm trying to take a flat quadrangle and transform it in a specific place and orientation. I know exactly where it should go (i.e., I know the exact vertices where the corners should be), but I get hooked to get it to turn in the right place.

Electro does not allow conversion matrices. Instead, you should transform the models using the built-in scale, position (i.e. translate), and rotation functions. The rotation function takes an object and 3 angles (in degrees):

E.set_entity_rotation(entity, xangle, yangle, zangle)

The documentation does not describe this, but, looking at the source of Electro, I am sure that the rotation is applied in the rotation order X β†’ Y rotation β†’ Z.

My question is this: if my initial object is a flat quadrangle lying on the XZ plane, centered at the origin, and the destination is in a different location and orientation where the target vertices are known, how could I use the electron rotation function to rotate it to the correct orientation before moving it to the right place?

I’ve been racking my brains for two days now, trying to figure it out, looking at the math, which I don’t understand, dealing with Euler angles, etc., but I'm still lost. Can anyone help me out?

+3
source share
2 answers

? . , ? , ? - API-, ?

, , . , euclideanspace.com.

+1

, , , : euler angles

, , , , , , , , .

, , .

0

Source: https://habr.com/ru/post/1723560/


All Articles