SmartBody allows you to change animations that have been loaded as assets. For example, motions can be translated, retimed, retargeted and segments of the motion can be rearranged. Changes made to these animations will be made in memory and will not be saved to disk unless the animation is then explicitly saved. This motion editing functionality can be accessed by calling various methods on the SBMotion class. Motions can be retrieved by name from the scene, as in the following example:
motion = scene.getMotion(motionname)
Editing Function | Description | Example |
---|---|---|
translate | Translates the specific joint by x/y/z units | motion.translate(100, 0, 20, "base") |
rotate | rotates a specific joint by x/y/z degrees | motion.rotate(45, 0, -30, "base") |
scale | scales the translation channels of all joints by a factor | motion.scale(10) |
smoothCycle | smooths the cycle of looped animation by fitting intervals in seconds at the beginning and the end together. The mirrored motion will be called 'motionname_smoothcycle'. | motion.smoothCycle(motionname, .1) |
mirror | mirrors a motion b y switching right and left joints. Assumes that left joints start with 'l_' and right joints start with 'r_' | motion.mirror(newmotionname, skeletonname) |
duplicateCycle | assuming that a motion comprises a single cycle, duplicates the cycle within the motion | newmotion = motion.duplicateCycle(numDupCycles) |
alignToBegin | for cycled animation, aligns a motion by moving frames from the end of the motion to the beginning of the motion. | motion.alignToBegin(numFrames) |
alignToEnd | for cycled animation, aligns a motion by moving frames from thebeginning of the motion to the end of the motion. | motion.alignToEnd(numFrames) |
retime | speeds up or slows down a motion by a scaling factor, where 1 = normal speed, .5 = half speed, 2 = twice speed | motion.retime(factor) |
retarget | retargets an animation onto a new skeleton (work in progress). Currently, the t-pose (or a-pose) between each motion will be aligned, and data will be fit onto the new skeleton accordingly. | motion.retarget(motionname, sourceSkeletonName, destSkeletonName, joints) |
trim | Tims the starting and ending frames of a motion | motion.trim(5, 23) |