Notifications
Clear all

[Closed] Orientation Constraint Bug?

I am having a wierd issue with orientation constraint and what rotation i actually get printed out of maxScript. In theory if you have an object with orientation constraint and only one target then the target and object should always have the same rotation. But if they have different parent objects and those parent object both have different rotation then they no longer have the same rotation.

Test this code to see what I mean.

Fn TestOrient TestNum =
(
–First i make two points
–The one which will used as the target has a box
–the one with the orientation constraint will have the axistripod
RotRef = point size:5 box:true cross:false axistripod:false centermarker:false wirecolor:blue
RotOrient = point size:5 box:false cross:false axistripod:true centermarker:false wirecolor:blue

 --make an orientation constraint and add the target
 RotCon = orientation_constraint()
 RotCon.appendTarget RotRef 100.0
 RotOrient.rotation.controller = RotCon

 --test to see if rotation matches by having a randon rotation be applied
 --Rotation will always match like this
 print "these are the first results"
 for o = 1 to TestNum do
 (
     rotRef.rotation = (random (quat 1 0 0 0) (quat 0 0 0 1))
     print (RotRef.rotation == RotOrient.rotation)
 )

 --Now we will add two new points to be the parent bones
 --we adjust them to have diffrent rotations
 --and we parent the rotRef and rotOrient
 ParRotRef = point size:7.5 box:true cross:false axistripod:false centermarker:false wirecolor:yellow
 ParRotOrient = point size:7.5 box:false cross:false axistripod:true centermarker:false wirecolor:yellow 
     ParRotRef.rotation = (quat 1 0 0 0)
     ParRotOrient.rotation = (quat 0 1 0 0)
         RotRef.parent = ParRotRef
         RotOrient.parent = ParRotOrient
         
 --test to see if rotation matches
 --Rotation no longer matches
 print "these are the new results after new Parent objects "
 for o = 1 to TestNum do
 (
     rotRef.rotation = (random (quat 1 0 0 0) (quat 0 0 0 1))
     print (RotRef.rotation == RotOrient.rotation)
 )

) –end Test Orient

TestOrient 6

These are the results I my self got. Is this a bug with in max or am I missing something?

“these are the first results”
true
true
true
true
true
true
“these are the new results after new Parent objects “
false
false
false
false
false
false

1 Reply

Try changing your printing line to

print (RotRef.transform.rotation == RotOrient.transform.rotation)

From what I know using the transform gets the object’s world transform rather than it’s controller’s offset from the parent hierarchy. Someone else might be able to explain it better though.