Camera move between two object based on a distance

Im trying to create a system that move camera smoothly between two preset positions (Child actors) based on the distance between two objects (player and enemy location). so there would be possibility for camera to stay in middle of the two points based on the distance. thank you guys

If you want to move the camera, the best way is using more than one camera and view targets. It looks like the camera is moving, but you just don’t have the hassle:

don’t know if it’ll help but you inspired me to play around a bit and the below script is the result.

As long as there is a target actor, we get a location 1/2 the distance between the player and the target, then we offset from that location horizontally and vertically based on the distance between the two. based on that information we set the cameras location and rotation. basically the camera stares at a location between the player and the enemy.

if no target actor then the camera moves to focus on the player. via a similar method.

i also used interps to smooth the movement when acquiring or losing a target actor.

1 Like