ScriptSpot

Forum topic · General Scripting

reverse biped animation

By real08121985 · 2009-11-28

Description

reverse biped animation, how can i do this via maxscript?

some ways i tried:

- reverse the animation by hand without script via scaling = works, but i need it scripted
- reverse the order of keys via moveKey-function = animation gets broken
- scale the timeinterval via scaleTime-function and scalefactor of -1 = animation gets broken
- reverseTime-function = does nothing

does anyone have a hint or something? big thanks :)

Comments (4)

real08121985 · 2009-11-29

i tested with the arm of a biped that got 2 keys: 1 = arm is up, 2 = arm is down. and i searched via google to find a solution and found this little topic at cgsociety http://forums.cgsociety.org/showthread.php?f=98&t=731337&highlight=biped…. that brought me to the biped.setTransform-function which i didnt knew until then and i started some testing.

the following testcode reverses the 2 keys at frame 10 and 30 .. looks promising, i think thats gonna work. hope it helps :]


(
	Obj = selection[1]

	time1 = Obj.controller.keys[1].time
	time2 = Obj.controller.keys[2].time
	
	at time time1 (
		pos1 = biped.getTransform Obj #pos
		rot1 = biped.getTransform Obj #rotation
		scl1 = biped.getTransform Obj #scale
	)
	
	at time time2 (
		pos2 = biped.getTransform Obj #pos
		rot2 = biped.getTransform Obj #rotation
		scl2 = biped.getTransform Obj #scale
	)
		
	setAkey = true
	
	at time -time2 (
		biped.setTransform Obj #pos pos2 setAkey
		biped.setTransform Obj #rotation rot2 setAkey
		biped.setTransform Obj #scale scl2 setAkey
	)
	
	at time -time1 (
		biped.setTransform Obj #pos pos1 setAkey
		biped.setTransform Obj #rotation rot1 setAkey
		biped.setTransform Obj #scale scl1 setAkey
	)
	
	deleteKey Obj.controller 3
	deleteKey Obj.controller 3
	
	movekeys Obj.controller (time1+time2)
)

Anubis · 2009-11-29

yeah, you are right, too many limitations in maxscript when come to bipped :/

real08121985 · 2009-11-28

yeah, try it for yourself, maybe i've done something wrong but simply nothing happened. :0

Anubis · 2009-11-28

reverseTime-function = does nothing ??