Camera following object with array modifier that moves along a spline

Hello everybody. I am currently modelling a roller coaster and I need a camera on the head of the train. I am animating the train on the curve using the curve modifier, not the follow path constrain because I am using the array modifier to repeat the roller coaster car along a curve.

I can not find a way to have a camera positioned on the head of the train. Do someone have a suggestion?

In this file you can find a simplified version of my problem.

cameraOnHeadOfTrain.blend (837.0 KB)

Doing it with a live array makes it more complicated than anyone would prefer. But it’s doable.

You can set up vertex groups after the array, but before any deformation, by using vertex weight proximity modifiers:

An alternative way to set up vertex groups would be via data transfer modifier from a non-rendering mesh (just a plane with some loop cuts) which would only require a single modifier.

Either way, make sure you read up on the modifiers you want to use, and learn how they work; it’s not all obvious from the screenshot.

You can then use these vertex groups as targets of copy location and damped track constraints (and other constraints, if you need) after deformation, either directly on a camera, or in this case, on an empty to which the camera is parented.

Hello, thanks for your reply. I know how vertices group works, but it is not clear to me Why do you have two objects in your screenshot, empty002 and empty 004? is it empty 004 the “container” of the camera?

One empty is damped tracking another. Otherwise, it will only copy location from the vertex group, leading to the camera staying in the same world space rotation. By having two empties, I can acquire rotation from the position of two different vertex groups.

It sounds complicated. Is there an easier way to achieve what I want to do. meaning, a camera following a “train” of objects on a curve?

If you apply the array, sure.

But if this is the only way to do this, could you please describe the initial setup, what is parented to what? Or maybe upload your .blend file? Many thanks :wink:

This is what I have tried . I have applied the array modifier, I have a vertex group to the first cube and I have set this constrain to the camera.

As you see the camera does not follow the cube properly. Doe you have some tips?

Ok, I have fixed it. I post here the setup in case someone else would find the same issue.
You need to apply the array modifier, then add 2 vertex group. One for the position of the camera and one for its lookAt.

Then add the following constrain to the the camera.

Thanks @bandages for putting me on the right track :wink:

I have a similar issue, but, not really, but maybe vertex groups would solve what I want to accomplish.

I have an object on a path and I am using the follow path constraint to move it and that lasts for 60 frames.

What I want to do is have that animation duplicate over the course of the video, which might be a minute long. Kind of like a walk cycle would, sort of… without an actual character walking… just a sphere moving on the path.

Typically, you would use an action created from the dope sheet and then push the action to the NLA editor, were you could duplicate the action, etc.

Since the constraint to follow the path is a modifier on the sphere’s f-curve, it can’t be key framed.

so, would grabbing the x,y,z locations from a vertex group be the way to go?? If, show me an example!

I need to convert the steps to python as well, which, when I understand a solution, I can do…

basically the idea I am working on deals with animating music …

Once you apply the array, you can just triangle parent the camera to the “engine”. Select mesh, enter edit, select three (and only three) verts, enter object mode; select camera, shift select train, ctrl p → vertex (triangle). The camera will act as if it is parented to the three verts you had selected, acquiring location and rotation from them (and maybe scale, I can’t remember, but for a camera that doesn’t matter anyways.)

No, VGs are probably not a great solution for that (but it never hurts to have a wide variety of techniques under your belt, so there’s no harm in experimenting with it.) You probably want to use a follow path with fixed position, animated offset-- not parent with follow path, which creates a motion path in object/relations, which is hard to work with. Then you can cycle your offset animation. An alternative is to bake the action.

But you might consider asking in a different thread, because it’s a bit unrelated; other people may not notice it down here.

great info… yea, all of this is going into an addon I am working on… the addon itself needs to be able to handle all the various animation types, e.g., bakes, paths, whatever. The end result of the add on is to have duplicate copies of “actions” on the NLA editor along the video at locations designated by a “marker” generated from an input text file with time offsets as data. That data comes from a musical source that is actually just a conversion to text in comma separated values. All of my code so far works, except for the follow path problem…

I tried baking the animation to an action, but, either I am doing it wrong, or I missed something…

I’ll try your suggestion … thanks…

Hi, you can just animate another empty along the curve and track it

14 days later but, actually vertex parent was the solution more stable and easier to implement. Thanks @bandages for the hint :wink: