I have this python code that creates and object sets 2 keyframes and then sets the interpolation between them to constant however instead of doing his properly it seems move the objects smoothly to a different location and then move then instantly to the location I want them to be. Here's a simple example of what it roughly looks like:
import bpy
scn = bpy.context.scene
verts = [(0,0,0), (0,5,0), (0,5,5), (0,0,5)]
faces = [(0,1,2,3)]
examplemsh = bpy.data.meshes.new("example")
exampleobj = bpy.data.objects.new("example", examplemsh)
exampleobj.location = (0,0,0)
scn.objects.link(exampleobj)
examplemsh.from_pydata(verts,[],faces)
examplemsh.update(calc_edges = True)
exampleobj.keyframe_insert("location", frame=0, group="Location")
exampleobj.location = (5,5,5)
exampleobj.keyframe_insert("location", frame=5, group="Location")
kf = exampleobj.animation_data.action.fcurves[0].keyframe_points[0]
kf.interpolation = 'CONSTANT'
The constant interpolation seems to work but not after an very odd curving motion. Does ayone know what's going on?
fcurves[0]
. Look in graph editor, x steps from 0 to 5 at frame 5. I believe what you want is constant extrapolation. See answer here ... or linear interpolation which will give a straight line between keyframepoints ? $\endgroup$