I am doing a keyframe scripted physics animation in Maya (with Python) and I want to show some vectors (results of the algorithm) that affect the animated objects.
To represent a vector I chose a curve:
import maya.cmds as cmds
vectorCurve = cmds.curve(d=1, p=[(x, y, z), (p, q, r)])
Then, when creating the keyframes for the animation, I do:
for i in range(300):
#a,b,c,d,e,f values change every iteration
cmds.move(a, b, c, vectorCurve + ".ep[0]", wd=True)
cmds.move(d, e, f, vectorCurve + ".ep[1]", wd=True)
cmds.setKeyframe(vectorCurve, time=i)
But when I run the script, the curves stay in their final position and do not move during the animation.
How could I set the animation keyframes for a (linear) curve correctly?
EDIT:
The curve actually has keyframes, but when I look into the keyed values in Channel Box, translate and rotate are all 0 and scale is 1 (for X, Y and Z).
setKeyframe
withcontrolPoints=True
, I'm not sure. Standard is definitely just TRS – Daniel SkovlicontrolPoints=True
tosetKeyframe
and it worked! Thank you very much, I must have overlooked it in the documentation. Now the curves move and change with the rest of the animation. Should I add it as an answer to this question or is it enough that it is in the comments? – Zdeněk