Hello Unreal community,
I’ve been developing a game with a camera system inspired by Dota 2. This system entails functionalities like middle mouse drag, edge pan, and even zooming. Everything is working smoothly, but I’ve run into a challenge due to the varied elevation in my level terrain.
My objective is for the camera to maintain a consistent height above any entity on the map, be it the player or any other object. This consistency is crucial for gameplay and visual perspective.
To break it down:
- I use a Spring Arm to handle the camera’s positioning.
- The Spring Arm has a fixed length (let’s call this “Y”).
- I want the base of the Spring Arm (where it attaches to the world or any object) to always remain a certain distance (let’s call this “X”) above the ground.
- Thus, regardless of the terrain’s elevation, the camera should always be “X + Y” units above the ground.
In effect, while the camera’s distance from the end of the Spring Arm remains static (unless zooming), the Spring Arm’s base needs to dynamically adjust its vertical position in the world to match the ground’s height below.
Has anyone implemented something similar or have insights on how to achieve this? I’ve been trying with line traces to detect ground elevation, but there might be a more efficient or direct method that I’m unaware of. Any guidance would be greatly appreciated!
Thank you for your time and expertise.