A character's movements change based on the camera's positon

So for my game I’m using the Roll blueprint and I’ve already got a camera set up so that it can rotate around like a third person camera. The problem is, the controls are still the same as they originally where in the default settings of the blueprint, meaning the controls don’t change based on where the camera is angled which can be very VERY confusing.

I’ll use the image for this example: Here the front of the ball is facing the bridge but the camera is to the right and up a bit, now the player would think that by pressing the W key they would move forward and go to the fence. However, this is not the case, and the player will just move towards the bridge since that is where the front of the ball is facing.

This problem needs to be fixed and I need to make it so that the ball’s movements change based on where the camera is. Could anyone help me with this or point me in the right direction? I’m a bit lost here.

If you wish to see my development thread, go here

Try looking at the player movement section of this tutorial, Spline Camera Tutorial - Blueprint Visual Scripting - Unreal Engine Forums, namely this part http://gregmladucky.com/blog/?attachment_id=471 where the player movement is set relevant to the camera view/rotation. It might not be the solution but hopefully it might give you some ideas.

By default the World direction of a movement input is based on the forward and right vector of the actor, at least for Characters, for the ball example it adds Torque. I think you will need to use your cameras Forward and Right Vectors instead or rotate your world direction vector based on the cameras position.

Get Player Camera Manager, Get Forward Vector and Get Right vector from that

Yep like Yog-Shoggoth and DEDRICK said you need to rotate the vector based on the camera, here is the screen shot from the tutorial:

That one is just for moving forward and the same needs to be done for the right but into the X input of make vector.

You can use the camera manager if you’d like shown there but you can also just reference the character’s camera as well. I used the camera manager because in the example it is jumping around between lots of different cameras and the manager already keeps track of the active one for you.

Here is just a modified version of the default rolling ball game:

We always zero out the pitch and roll as we just want to move based on our Yaw

Hope it helps!

1 Like

If your camera is on a fixed angle. you could also just rotate the angle manualy the degrees you need.
to do that add/rest to the yaw value the grades your camera is rotated. in my case were 45 exact grades.
I would post an screen but i delete the proyect i did that. :frowning:

I did than once and it works perfectly until you want your camera to rotate

Nearing the end of my assignment I have decided to remove the new camera I have implemented into my game and replaced it with the old camera. Reason for this being: I can’t fix the many annoying problems with it and haven’t the time to perform research on how to fix it, though I thank everyone who has helped me or tried. It is very much appreciated.

The part between make vector & inputaxis moveright… what is that & how do I get it in my project? (Yes Im a noob to this trying to learn)…

Does anyone have access to that tutorial or screenshots? Seems like tutorial OP deleted it.

Probably out of date now but I use Ultimate Spline Camera System, and then set up movement as follows for a character:

Probably don’t need the GET. The trick was the pitch being 0 on the Y axis for forward movement. Otherwise the player slows to a crawl if the camera becomes top down, for example if it’s tracking overhead and player is under it.

This works with splines and fixed cameras, so it’s basically like Resident Evil alt controls or early Final Fantasy 7 to 9 if you go for more overhead view. Seems to work just as well if your camera goes into side scrolling or third person shoulder cam too.

Anyway, that worked for me, maybe it will help someone.