2

What I want to do is to have multiple identical cubes all following the same (non-circular) path, each with a different starting offset. And when one cube reaches the end, it teleports back to the start and continues along that path again. I want to do this without having to manually animate everything.

I tried to do what they suggested here: How may I create a continuously looping animation? by animating the evaluation time on the path and making that cyclic, but that doesn't seem to work for multiple objects.

What I want to happen (using multiple paths to do this, want to use a single path): What I want to happen

What happens when I use a single path and set the offset values on the cubes: What happens when I use a single path

8176135
  • 777
  • 10
  • 23

1 Answers1

1

Using Drivers and Follow Path constraint.

Drive the offset of the constraint from 0 to 1 using Fixed Position.

Hard coded 250 as the path length in frames. The driver method has two parameters, the current frame (scene.frame_current is known to the driver namespace as frame) and the offset at frame 0.

import bpy

path_length = 250 # path length in frames

def offset(frame, start=0):
    # start position at frame 1
    f = round(frame + start * path_length)
    return (f % path_length) / path_length

bpy.app.driver_namespace["offset"] = offset

Sample file and image with Cube (offset 0), Cube.001 (0.2) and Cube.002 (0.4).

enter image description here

batFINGER
  • 84,216
  • 10
  • 108
  • 233
  • Seems to work pretty nicely so far, though I would like to see if there's a solution without the need for any scripting. I'll accept the answer tomorrow if nothing else comes up. – 8176135 Aug 30 '17 at 09:59