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).
As discussed in the comments, OP's issue was solved by specifying that control points
should also be keyed:
# Original code
cmds.setKeyframe(vectorCurve, time=i)
# Becomes
cmds.setKeyframe(vectorCurve, time=i, controlPoints=True)