Orientation Constraint Bug?

Okay I have noticed this before and found it to be very some what problematic in a couple of scripts I like to create. When you try to pull the rotation from and object that is using an orientation constraint controller you get very odd results. Here is an example.

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

once i ran this code i got results saying that once they are parented to different objects with different rotation their own rotations no longer are the same. I know an easy fix would be to just make them both have the same parent but that's not always and and option. Any ideas guys?

My results

"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

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
MKlejnowski's picture

correction. They actually do

correction. They actually do this even if they have the same parent. It only has the same results when the object with the orientation constraint has no parent.

br0t's picture

Mhm parenting stuff will

Mhm parenting stuff will change their coordinate system I think, maybe thats why you get problems. Maybe instead of linking something you could use a pos/link constraint, or link before applying the orientation constraint or use "Freeze Transforms/Freeze Rotations". Cant test it right now, so its just some ideas

Never get low & slow & out of ideas

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.