Does anyone have any Unreal Engine experience and can help me with this conundrum I have at the moment?
I'm trying to implement a lock-on camera system. Found a YT tutorial which got me started, but I'm aiming for a Nier Automata style camera where focal point is equidistant between the player and target. I do this by first offsetting the camera by a constant, then having the camera LookAt the midpoint between the player and target.
The problem arises when the distance between player and target are close enough that the static offset of the camera forces it to continuously rotate to try and focus on the midpoint. But because the offset length is constant, the camera will never reach B so it just keeps spinning.
I've made some illustrations:
where A is the player, B is the midpoint/target, C is the camera, CB is the camera boom (a Spring Arm Component) and CBO is the offset from the camera boom's endpoint.
The problem is illustrated below:
When B is too short, C will try to pivot around A, but the constant offset of the camera means that it will never reach B, and so it'll just spin endlessly.
I thought up two ways to solve the problem, but I don't know how to do either:
1. Rotate the camera C on itself (instead of pivotting around A). I've tried to apply SetWorldRotation of the camera component to the LookAt vector, but that doesn't seem to work... The camera doesn't even rotate.
2. Shorten the distance of cb -> cbo (or a->c) so that c -> b will meet again. Unfortunately my trig is poor, and I can't figure out any solutions that do not involve rotation of C's angle (which really just brings me back to solution 1)
Anyone got any ideas?