Some issues with trying to get camera to follow between player character and mouse in Blueprint

So, I’ve been working on setting up a top down camera for a game project, and I have managed to get through making the camera point at a spot between the mouse and player, so I don’t think there’s any worries about that area.

However, I’ve been facing an issue, 2 issues in particular.

A) When the player character begins to move, there’s a brief moment where the camera slightly jumps a few units up or down when beginning to move in a new direction before it jumps back to a normal position.

B) Anytime the mouse hovers over any objects in the scene that isn’t just flat ground, like a wall, prop, etc, it slightly offsets the camera while pointed over said object.

So, my main question is, is there a way of making it so the camera doesn’t jump around when it hovers over something else? Fairly sure that ones a collision issue but not sure of the solution. And is there a way of fixing the way it randomly jumps about when I move the character at all?

For reference, I’m using the third person template for the project. Included a picture of the first person characters blueprint for moving the camera halfway between the mouse and player below.

image

You’re tracing on the visibility channel which everything blocks. You could create a new channel that everyone ignores by default:

Everyone apart from the elements of your scene you want the mouse to trace against:

This particular test only cares now about a single channel.


Also, here’s an alternative approach that uses screen space instead:

1 Like

Hey there, thanks for the solution with the trace channel, that worked great for it!

Though, I’m still facing the stuttering issue when the character begins moving in any direction they weren’t already moving. Would you happen to know a fix for it? I’m not sure what exactly’s causing it.

1 Like

How are you moving the character?

I’m mainly just using the base character movement from the Blueprint you get right off the bat in a Third Person Project. WASD Movement.

Can you show what this is connected to? Does not look right, a bit odd. Why are we adding movement input twice?

Could you also briefly explain how the character should move, ideally. We’re using roll with the character - what’s the end goal here?

I’m honestly not sure. It’s just how it came with the standard third person character blueprint. It’s using the new 5.1 input system they added.

As for how the character should move, the camera’s basically just meant to be top down for a birds eye view with it not moving from the top down angle or rotating at all, with the character moving up, down, left and right with WASD. And they do, that’s all working with the set up I’ve got right now.

Wish I understood the setup better:

image

You’re setting the world location of the camera, does it also mean that you’ve set the camera component to operate in absolute location and rotation. And since this is based on the third person template… Is there a springarm? Or is the camera a separate actor, either with or without a springarm?

For reference, I’m using the third person template for the project. Included a picture of the first person characters blueprint for moving the camera halfway between the mouse and player below.

Here you mention both 3rd and 1st person perspective. Just having hard time wrapping my head around what the intention is. Especially that you’ve also mentioned this is supposed to be top-down :smiley: So it’s a bit 3 in 1.

Disregarding the method used, how similar is the ideal behaviour you’re after when compared to the alternative method I linked above?

Here you mention both 3rd and 1st person perspective. Just having hard time wrapping my head around what the intention is.

Ah, mentioning the first person character was a typo. So used to doing the first person stuff now it accidentally came to mind lol. I meant the third person character.

But no, I don’t have any springarm component. I do have a Camera Boom Component though which is just connected to the player. And I’m not sure if it’s operating in absolute location and rotation.

1 Like

Could you confirm how similar is the behaviour to what I linked?

It’s a spring arm component that someone conveniently renamed to Camera Boom Component just to make it sound more fancy, surely:

image

  • you should be moving the springarm, not the camera - that’s one potential source of the jiggles
  • since the component’s movement is supposed to be (at least semi) independent, it should be in absolute mode; that’s the 2nd potential source of inconsistencies
  • and yet another source could be the lag settings on the springarm, but that’s unlikely, especially if the settings have yet to be modified from the defaults

Do check the thread I linked, the component setup is there.

Ooooohhh yeah, just hovered over it and yeah, it’s a Springarm. I changed it to that instead of the camera and that definitely fixed the jittering.

Though, now in certain spots like a staircase the camera starts freaking out rapidly. Like, rapid fire flashing and vibrating when the mouse is hovered over any elevation.

It’s most likely flipping out because it lives in relative space and you’re forcing world position, and it probably tries to follow the player’s rotation, too. Read above.

I did change it to absolute, but it’s still causing the issues. Should I instead change the set world location parts to set relative rotation?

Edit: Just tried what I mentioned above but the issue’s still happening with set relative location. Working on just implementing the method you had above, will update on if that works.

So I tried setting things up the way you showed in the post you linked, but when I set up all the nodes, I got 2 errors in the subtracting and multiplying nodes.

Edit: Wait, I’m a fool, just read a bit further down, lemme try that.

It’s not the method, it’s the component setup:

By default the springarm inherits from the control rotation and lives in the character’s relative space.

Sorry to keep pestering but, I got that working, but there’s a problem.

While it doesn’t do the rapid vibrating it was doing earlier, now it seems to just get the camera stuck inside of objects when it hovers over them. Like seen below:


Again, I did actually update it to absolute, but the issue is still occurring

Picture3

This is called a Gimbal Lock and is another can of worms, one that I do not talk on Mondays.

Set this to -89.9:

image

:innocent:

Somehow the camera ended up upside down.

Did you miss the minus sign by any chance?

H m m . Y e s. Always the little things lol.

Though, even now that I’ve set it to -89.9, it’s still doing that issue I mentioned above of going into objects.

I think that maybe it’s the same collision issue that you gave the solution of making a new trace channel path for. Is there a way to get the Springarm to be on that channel instead of the Camera channel by chance? Cause I cannot find it for the life of me if it does exist.