[Closed] Align Rotation
Hi,
I’m trying to align an object’s rotation to another object’s rotation via MaxScript. So you might think that is easy to do, but in special cases it is not. I have tried a number of different methods without success.
The problem is, I have an attachment controller on one object and trying to assign the proper rotation values to match another object’s rotation.
Actually I’m just trying to find out how to do the exact same thing as the Align tool does. But I just can’t figure it out. Hopefully you can help me.
Please take a look at the attached scene. There are two point helpers and a surface. One point helpers has an attachment controller assigned, targeted to the surface. The other point helper is just placed somewhere and has a different rotation. I’m trying to set the rotation of the point helper with the attachment controller assigned to match the other point helper.
You can open the scene and evaluate the following code:
$Point008.transform = $Point004.transform
It works. However, due to the attachment controller, the other way around does not work correctly:
$Point004.transform = $Point008.transform
Can someone help me out with this very simple problem? Thanks in advance:)
the attached point is using “Align To Surface” method. If you want to set the rotation yourself you have to set it the align property to OFF.
another solution is to have a Rotation List as rotation controller for the attached point.
Well, I guess you didn’t get the point.
I already did all that stuff. I want to have align to surface turned on as I want to have the point rotate with the surface deformation.
Also, I already assigned a rotation list. This exactly is the problem. How to align the rotation to the other point (initial rotation) via MaxScript? As if I would use the Align tool?
Got it?
EDIT:
Ehm… btw… It’s not a rotation list, forget it. Anyway, rotation list is no solution at all. This is not about a simple basic problem here. It is all about how to assign the correct rotation values via MaxScript to match the other point’s rotation. Please review and understand the problem before you reply. Thanks:)
Problem might be that there is some kind of hidden rotation data when using an attachment controller. Actually all I want to do is zero out this hidden rotation data, but still have the point aligned to the surface, and use the initial rotation of the other point helper. Or, if there is no way to access this hidden rotation data of the attachment controller (which I expect), there must be a way to assign the correct offset rotation values to match the other point’s initial rotation. That’s it
it’s confusing me what you want to do. You want to have a point aligned to the surface and at the same time align to another TM. How might it be possible?
you can achieve only some kind of look-at orientation, but it can’t be exact same rotation as source point.
$point1.transform = translate ($point2.transform.rotation as matrix3) $point1.transform.pos
r = $point1.transform.rotation * (inverse $point2.transform.rotation)
$point1.rotation *= r
i’ve thought a little more and here is better version (the first line is useless):
$point1.rotation *= $point1.transform.rotation * (inverse $point2.transform.rotation)
Please understand that I am talking about INITAL rotation only. Thanks .-)
it multiples one quat on another, which means rotate first quat on second quat.