Make an angled Top-Down Camera follow the mouse?

Hello

I am trying to recreate the mouse control / camera control / aiming method from the game Running With Rifles.
Example here:
https://youtu.be/-JTE7Qi3X18?si=5-LK_eUKgDZkI3MR&t=891

So the MainPlayer_BP stays in center screen at all times and I can move the mouse around the main player freely with a fixed distance so the player is always in view.

The camera setup is like this:

Camera is at a 40 degree angle, which is causing me a headache with my attempt here:

This doesn’t currently work.
I think it’s my attempt at using Get Mouse Positions.

So I’m trying to create a clamped square around the player using the MaxCameraOffset.

I’m not sure of it’s the correct way to do it by I’m trying to just plug Actor Location and the clamped square into VinterpTo to have the camera move smoothly to the new location.

At the bottom I had it connected up with Convert Mouse Location To World Space instead of …Scaled by DPI.

I had that made into a vector together with Actor Location and that set into Vector Clamp Size 2D., but it didn’t work. Just moved the camera in opposite direction of mainplayer forward vector.

Am I on the right track here or is this the complete wrong approach?

Hey @Tensdale!

You can check out this approach of mine from another topic on the same subject!

The only difference from your objective would be that this approach expects an input to drag the camera, which you can easily change by triggering the logic after Event Tick instead of an IA.

Hope this helps! :innocent:

@VisAgilis
Okay, I’m trying. But I’m still not sure the correct way to trigger it with the mouse position yet. Any tips on that?

This is what I’ve created so far, and it clamps my spaceships movement in space itself to the 1000x1000 square I defined.

You can get the hit result under cursor by dragging the Get Hit Result Under Cursor by Channel node out of the Get Player Controller node, break the hit result, get the location pin’s x & y values and constantly set the camera’s location to them while keeping it’s own z value :blush:

How about this as a base:

The above does not rely on geometry - can be handy when making a space game and there’s little to trace against.

1 Like

Good point :star_struck:

I really enjoy how this part is unapologetically and technically OK:

Happy little accidents.

2 Likes

I think that was a social experiment :rofl: