PDA

View Full Version : Maxscript : Animation Loop...


djogcn
11-21-2007, 12:19 PM
Hi,

I'm writing a tool to optimize model for realtime...
Now I'm on animation export.
3DRT needs animations to loop.
Take animation from mocap , cut where it seems to loop.
Now I have to correct the key to real loop.
In 3dsmax there is no tools... just the mouse ...
So I'm wrinting somethings like Weighted average keys...

Lenght = animationRange.end
smoothValue = 3
for o in objects do
(
try
(
sliderTime = 0

Pos = biped.getTransform o #pos
Rot = biped.getTransform o #rotation

NewPos = [0,0,0]
NewRotation = (quat 0 0 0 0)

for i=0 to smoothValue do
(

sliderTime = Lenght-i

Pos2 = biped.getTransform o #pos
Rot2 = biped.getTransform o #rotation

NewPos[1]=(((Pos[1])*(smoothValue-i)) + ((Pos2[1])*i))/smoothValue
NewPos[2]=(((Pos[2])*(smoothValue-i)) + ((Pos2[2])*i))/smoothValue
NewPos[3]=(((Pos[3])*(smoothValue-i)) + ((Pos2[3])*i))/smoothValue

NewRotation.x =(((Rot.x)*(smoothValue-i)) + ((Rot2.x)*i))/smoothValue
NewRotation.y =(((Rot.y)*(smoothValue-i)) + ((Rot2.y)*i))/smoothValue
NewRotation.z =(((Rot.z)*(smoothValue-i)) + ((Rot2.z)*i))/smoothValue
NewRotation.w =(((Rot.w)*(smoothValue-i)) + ((Rot2.w)*i))/smoothValue

biped.setTransform o #pos NewPos true
biped.setTransform o #rotation NewRotation true
)
)
catch()
)


It works sometimes.. if the bones has rotation and position keys..
I'm not able to detect what kind of key it is...

If somebody know something ... this will make me so happy.. I'm going crazy...

Or maybe there is an other technique ... without maxscript...

Thanks :-)

sorry for my english , I do my best...

CGTalk Moderation
11-21-2007, 12:19 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.