Hi everyone,
I have been trying to find a way to access the coordinates of the ‘cube’ object in an animation but I cannot seem to find anything that works.
I offset the cube up on the z axis and then let it fall. The animation lasts for 15 frames. I tried the following code:
- import bpy
- cube=bpy.data.objects[‘Cube’]
- for f in range(sce.frame_start, sce.frame_end+1):
- bpy.context.scene.frame_set(f)
- print(“Frame %i” % f)
- print(cube.location)
However, the ouput I get only contains the initial location, instead of the location at each frame:
Frame 1
<Vector (0.0000, 0.0000, 4.7058)>
Frame 2
<Vector (0.0000, 0.0000, 4.7058)>
Frame 3
<Vector (0.0000, 0.0000, 4.7058)>
Frame 4
<Vector (0.0000, 0.0000, 4.7058)>
Frame 5
<Vector (0.0000, 0.0000, 4.7058)>
Frame 6
<Vector (0.0000, 0.0000, 4.7058)>
Frame 7
<Vector (0.0000, 0.0000, 4.7058)>
Frame 8
<Vector (0.0000, 0.0000, 4.7058)>
Frame 9
<Vector (0.0000, 0.0000, 4.7058)>
Frame 10
<Vector (0.0000, 0.0000, 4.7058)>
Frame 11
<Vector (0.0000, 0.0000, 4.7058)>
Frame 12
<Vector (0.0000, 0.0000, 4.7058)>
Frame 13
<Vector (0.0000, 0.0000, 4.7058)>
Frame 14
<Vector (0.0000, 0.0000, 4.7058)>
Frame 15
<Vector (0.0000, 0.0000, 4.7058)>
What am I doing wrong here?
Thanks