Keeping top-down camera at certain height above ground

The main character in my game has a spring arm attached to it, with a top-down camera attached to that spring arm, always following the character. Now when I move the character around the map, it can change its Z-world position, e.g. when it jumps or walks up a ramp. In that case the spring arm and thus the camera also changes its height accordingly (i.e. the camera always keeps the same distance from the character).

Now what I want is the camera following the characters movement in X and Y, as it does now, but always keeping the same height above ground. So even when the character e.g. jumps, the camera must not alter its Z-world position.

What would be the best way to achieve that camera behaviour (via Blueprint)?

One way to do this would be by manually setting the camera’s (or spring arm’s) x/y per tick (using set location node) to the player’s x/y, while keeping the z to whatever height you want.

So at tick event -> set world location (x=player’s x, y=player’s y, z= some constant value).

Hmm… I thought about setting the camera location manually via tick event.
However, that way I might loose some nice spring arm functionality, e.g. its lag feature.

Or in other words: If I set the camera location manually to follow the characters’ X and Y,
would I then need the spring arm at all?

You wouldn’t set the camera’s height each frame, you’d need to find the angle of the spring arm from the player and increase / reduce its length to keep the camera at a same height (think of the sides of a triangle - use the opposite and hypotenuse to set the length of the adjacent).

Alternatively, you can ditch the spring arm and use the VInterpTo action to keep the camera moving with a lag on it.

Thanks for the ideas, I guess that would work well.
Alternatively, how about limiting the Z-movement with a camera blocking volume?

Ok, just tried the camera blocking volume.
And it works like a charm :slight_smile: