Camera Offset Problem Solving

Hi, I’ve been racking my head for hours now trying to come up with a solution to the following problem.

I have a 3D sidescroller fighting game, in which I want the camera to “follow” both of the characters by positioning itself at the midpoint between them. Additionally, it should be offset as to act as a purposeful camera.

However, as this is 3D game, the characters and camera are often rotated to accommodate the levels, so a universal vector offset cannot be used.

In order to achieve the desired effect and for functionality with no dependency on fixed rotations, the use of the rotation of the camera must be used to achieve the desired vector offset.

Thanks,
Alfie

I think there is a node to find the midpoint on a plane or line. You can define that plane or line using the two player pawns locations as the start and end positions. Then just have the camera turn to the LookAt Rotation with that point as the target. Also you can pull the camera back or change fov based on the distance between the players.

The solution I came up with was to use the FindNearestPointsOnLineSegments node with the first segment being the first and last point of a spline component, and the second segment being the centre point between the characters.

This locked the position of the camera perfectly along the spline component which of course solved all the previous issues mentioned.

1 Like