PDA

View Full Version : Blending transforms


pchela1313
08-07-2008, 04:46 PM
Hi, I wrote a script that can save transforms for any objects. Also it shows a preview of stored poses. It works quite well, but now I want to add a slider that will blend between this poses. I made this slider but the problem is that the transforms blend in linear way.

Just like on this image:
http://www.pchela.pl/Scripts/BlendError.gif

But I want to make it blend based on circle curv. Because now it works like stretchy system. How can I made this to work?

Here is a part of script for this slider:

on BlendPosesSl changed i do
(
if ca.count > 0 then
(
for b = 1 to (ca.count-1) do
(
--curTrans[b] - current Trasform of object that is stored
--vals[b] - a saved pose
temp2=vals[b] * PivotPose.node.transform
temp4=(matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0]) -- temporary matrix
temp4.row1 = (temp2-curTrans[b]).row1 * [i,i,i]
temp4.row2 = (temp2-curTrans[b]).row2 * [i,i,i]
temp4.row3 = (temp2-curTrans[b]).row3 * [i,i,i]

temp4.row4.x = (temp2-curTrans[b]).row4.x * i
temp4.row4.y = (temp2-curTrans[b]).row4.y * i
temp4.row4.z = (temp2-curTrans[b]).row4.z * i

withBadScale = curTrans[b]+temp4
EndTransform = (matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0]) -- another tomporary matrix
EndTransform.row1 = withBadScale.row1
EndTransform.row2 = withBadScale.row2
EndTransform.row3 = withBadScale.row3
EndTransform.row4 = withBadScale.row4
EndTransform.row1 /= withBadScale.scalepart.x
EndTransform.row2 /= withBadScale.scalepart.y
EndTransform.row3 /= withBadScale.scalepart.z
theSourceScale = vals[b].scalepart
theTargetScale = EndTransform.scalepart
EndTransform.row1 *= (theTargetScale.x + ((theSourceScale.x-1)* i))
EndTransform.row2 *= (theTargetScale.x + ((theSourceScale.x-1)* i))
EndTransform.row3 *= (theTargetScale.x + ((theSourceScale.x-1)* i))
AllObjects[b].node.transform=EndTransform
)
)
)

CGTalk Moderation
08-07-2008, 04:46 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.