PDA

View Full Version : apply a rotation partially


sheb
02-23-2005, 11:07 AM
Hello people!

Im stuck once again! I have a chain of bones - now i want to apply the xrotation of one bone to another. I managed to get the whole rotation by

multiplying both objects with their inverse parent transform
set the rotation and transform back (again with the parents transform)


r = $bone02.transform*inverse ($bone01.transform)

t = $bone03.transform*inverse ($bone02.transform)

t[1] = r[1]
--it works ifi set all three
--t[2] = r[2] --$bone03.transform[2]
--t[3] = r[3] --$bone03.transform[3]

t = t*$bone02.transform

orthogonalize t

$bone03.transform = t






however if i try to set only one part of the rotation the object gets skewed. I can orthogonalize its matrix but then the rotation isnt right anymore :/

Any help as always greatly appreciated!

seb

sheb
02-23-2005, 12:21 PM
If anybodies interested. here is the solution I think.



r = copy $bone02.transform*inverse ($bone01.transform)

t = copy $bone03.transform*inverse ($bone02.transform)

--need to use eulerangles
re = r.rotationpart as eulerangles
te = t.rotationpart as eulerangles

te.z = re.z
te.x = re.x

rotpart = (te as Matrix3)

t[1]=rotpart[1]
t[2]=rotpart[2]
t[3]=rotpart[3]


t = t*$bone02.transform

--orthogonalize t
$bone03.transform= t

CGTalk Moderation
02-23-2006, 01:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.