Always look at the fastest actor with the camera!

Hi everyone.

I have a problem that I cannot find a solution to and I hope someone can help me.

I have 7 actors moving at different speeds randomly along the X axis and I would like my camera to move along the X axis at the speed of the fastest to make sure I always show the first runner.

Do you have any suggestions?

Thanks!

You can use the GetVelocity node to figure out which actor is moving the fastest and point the camera at them.

Exacly how you do that depends on a lot of things like:

  1. Are these just actors being moved by the level BP?

  2. Are they BPs moving under their own steam?

  3. Is there a camera just sitting in the level?

  4. Is there a player character watching, and you intend to move the player camera?

  5. Is there a BP containing a camera in the level?

Etc yada yada yada…

The knot you suggested is really very interesting and I think it will be useful in other situations as well. In my project, however, the speed of the actors constantly changes randomly and not necessarily the fastest is also the one further ahead on the x axis.

in the project the actors move by themselves directly from their event graph.

In the level there is a camera that is not part of any blueprint.

My initial idea was to use Event Tick to read the vector X value for each actor and select the highest one with the Max node and then set the Camera location to this value.

Sorry for my English…

Your idea sounds fine. Have you tried it?

Yes, I tried and it works, but the camera moves constrained to the framerate and I noticed that the actors occasionally pulsate graphically as if it were a glyc. if I put a fixed or independently moving camera it doesn’t happen so I thought the problem was the event tick.

Can you show the code?

The problem with my code is that once in a while the actors have a glich, they disappear and reappear a couple of times very quickly.

If instead I move the camera for example by binding it to one of the runners it doesn’t happen.

Could it be the event tick? Could I improve the blueprint using delta second?

You’re setting the camera with a jolt.

Try it like this:

Great, I’ll try it now, thanks so much! :wink: