Hello folks!

Want to talk about of align animation result between align tool and maxscript metod.

Look at the attached file and you will see that the standard alignment tool always gives a more accurate result in animation. Getting a similar result using the max script command like

`A.transform = B.transform`

does not always work.

Of course, before creating a topic, I did a lot of searching on this issue, and found this topic with an example from PEN - Paul Neale

`b=Box pos:[-20,0,0]`

`b.transform=(matrix3 [0.904582,-0.426096,0.0132061] [0.35901,0.744726,-0.562579] [0.229877,0.51364,0.826638] [-20,0,0])`

`s=sphere segments:4 pos:[20,0,0]`

–Rotate the spheres matrix around it’s own position.

`s.transform=(b.transform.rotationPart as matrix3*transMatrix s.transform.pos)`

But alas, code written based on PEN example

`A.transform = (B.transform.rotationPart as matrix3*transMatrix B.transform.pos)`

gives the same result as this code

`A.transform = B.transform`

Look animation in attached max file.

In general, of course, we have a method for getting the same result as when using the align tool. This method is based on obtaining an angle of three points for each axis (XYZ) How do I find the angle between 3 vertices? And after we get all the angles, we will have to do some calculations between the old and new angles to get the angular difference and determine the rotation vector based on the near angle. So in my head, this code takes at least 42 lines and I thought that it is very much for such a task.

So, I am sure that experts and transform matrix gurus know the shortest path for this task solution And I hope they have some free time to share their examples and tips with us

Scene_For_CGS.max (460 KB)