1

I need to add a Follow Path constraint to an object and also set up key frames to turn off the influence of that constraint after one rotation around the path: https://docs.blender.org/api/current/bpy.types.FollowPathConstraint.html#bpy.types.FollowPathConstraint

I found an influence adjustment here but I can't seem to even get the constraint working in the first place. Some guidance on this issue would help my overall understanding of the Docs.

brockmann
  • 12,613
  • 4
  • 50
  • 93
  • 3
    Examples in https://blender.stackexchange.com/questions/168913/how-do-i-add-a-camera-so-that-it-moves-along-a-path-while-focusing-on-an-object/168948#168948 https://blender.stackexchange.com/questions/118290/continuous-looping-animation-differing-rotational-speeds https://blender.stackexchange.com/questions/91455/i-am-trying-to-make-an-animation-of-a-double-planet-cant-seem-to-get-it-right https://blender.stackexchange.com/a/176762/15543 – batFINGER Mar 12 '21 at 18:59
  • Thank you these are helpful – Graham Thomas Mar 12 '21 at 19:04

1 Answers1

2

Following code worked for me:

import bpy

ob = bpy.context.object curve_ob = bpy.data.objects["Plane"]

con = ob.constraints.new('FOLLOW_PATH') con.target = curve_ob

curve_ob.data.use_path = True anim = curve_ob.data.animation_data_create() anim.action = bpy.data.actions.new("%sAction" % curve_ob.data.name)

fcu = anim.action.fcurves.new("eval_time") mod = fcu.modifiers.new('GENERATOR') mod.use_restricted_range = True

mod.frame_start = 1 mod.frame_end = 100