In this python script:
import bpy
import math
# Place the reference of the selected 3D object in a variable
mon_objet = bpy.context.object
" We fix the object to the desired position "
mon_objet.location[0] = 2.2
mon_objet.location[1] = 0
frame_num = 0
entre_chaque_keyframe = 1
bpy.context.scene.frame_start = 0
bpy.context.scene.frame_end = 135000
for n in range(0,6300):
x=4.4*math.cos(n)/(math.exp(50*n)+math.exp(-50*n))
y=4.4*math.sin(n)/(math.exp(50*n)+math.exp(-50*n))
z=2.2*(math.exp(50*n)-math.exp(-50*n))/(math.exp(50*n)+math.exp(-50*n))
# We are on the right frame, frame_num is 0 at the beginning
bpy.context.scene.frame_set(frame_num)
#We create a location keyframe
mon_objet.location=(x,y,z)
bpy.ops.anim.keyframe_insert_menu(type='Location')
# We increase the value of the next frame to fix
frame_num = frame_num+entre_chaque_keyframe
my goal is to insert a position key at each new location of the object. The successive positions of the object are in a spherical helix; In general, this kind of script worked very well (no error) for other parametric equations but here I do not see the error. The python console says: "syntax error: bpy.context.scene.frame_set (frame_num)" Why ?
Thank you for your help