Why is my forward and backward movement slower when aiming at ground in FPS template?

Hi there, whenever I go into play mode and look upwards characters movement slows to almost to a halt, (this happens when I look down). slowing of movement happens only when I move forwards or backwards ( W key or S key) however If I move left to right ( A key and D key ) speed of character stays same ( as if I was looking straight)

Thanks in advance!
Regards!

Hey DVSN,

What you’re seeing is a result of Get Forward Vector being connected to Get Control Rotation. If you open up MyCharacter Blueprint, you can see what I’m talking about; InputAxis MoveForward node is attached to Add Movement Input node, which in turn grabs forward vector according to Pawn’s rotation. problem is that when player aims down or up, forward vector is not aligned with x axis (as Get Right Vector is, as you already pointed out).

To left of Movement Input section of MyCharacter Blueprint is Mouse Input section. InputAxis LookUp node is attached to Add Controller Pitch Input. problem with that is we don’t want to rotate entire Pawn because that adjusts our forward movement. Rather, we just want camera and arms mesh component to rotate.

So how do you adjust this? Let’s disconnect InputAxis LookUp node from Add Controller Pitch Input. Then, set up following:

What we’re doing here is setting relative rotation of a component of pawn instead of whole pawn. In your Components tab, attach your FirstPersonCamera component to Mesh1P, and attach Mesh1P to Mesh.

5333-5-1-2014+4-29-42+pm.png

Now when you move mouse up and down, you’re just rotating arms mesh and camera component. rest of nodes we’re using are clamping rotation so you can only look up and down to desired degree. Let me know if you have any specific questions on how this is working.

Note: You’ll also need to adjust how your projectile is fired, because by default that is also set to follow Pawn rotation. Since we’ve disabled rotating whole Pawn up and down, projectile will only fire straight forward on x plane. To fix this, adjust following in Spawn Projectile section of MyCharacter Blueprint:

We’re just replacing Get Control Rotation node with a Get World Rotation of Mesh1P component. Play with settings for Gun Offset vector node if you want to make shots more accurate.

Hope all that helps!

Hi , I haven’t tried solution but glitch is consistent across all projects even sample ones. Any suggestions?

Hey DVSN,

I don’t see a glitch anywhere. Try Shooter Game. If it’s happening to you in Shooter Game, then we can look into it as a bug. Otherwise, it’s happening because default Blueprint is very simple.

template is a very basic setup for a FPS game that can certainly be improved upon, and that’s why I gave you a way to get around issue using Blueprints. default setup includes a very simple, easier to understand Blueprint for forward motion, but it has problems I listed above because it is so simple. Try out changes I suggested and it should give you more control over how your character moves in your project.

I’m having same issue and am trying to setup my LookUp input same way has it in that first picture, but I cannot find Target to Relative Rotation node? I’ve searched ‘Relative’ with context sensitive off but no luck.

Hey W,

Are you doing this inside your character Blueprint? When you drag off InputAxis LookUp node and type in Relative, there should be four options including one we’re looking for: “Set Actor Relative Rotation.”

Hey , thanks for responding.

Sorry I wasn’t more clear, I see now there are two nodes in that image with words 'Relative Rotation;. I am able to find ‘Set Relative Rotation’ node but not smaller purple node that has just target input and relative rotation output…

Nvm, I just figured it out as I was writing this. I was trying to find ‘Get Relative Rotation’ node without pulling from ‘Get Mesh’ first.

Thanks.

Hi , Thanks for help on this as it was driving me crazy for a bit but it seems I’m not out of woods yet.

I’ve got this set up like you have above but camera is not rotating correctly with arm mesh.
Just to be sure it was not something I did in all my messing around I started a new FPS Blueprint project and redid fix and I’m getting same thing.

[Quick Video Link][1]

Fixing projectiles worked fine but I did not set this up yet when I recorded video

Am I just overlooking something here? I checked it over so many times.

EDIT: Ended up going with W1930U7’s solution below, however thanks for help as always.

I believe I have found a much simpler solution.
Set you Mouse input back to way it was and just set your movement input like this:

2 Likes

Beautiful, That worked perfectly. It also fixed an animation bug introduced by other fix.

I owe you a beer.

I have a question as to why all of math is necessary here.

Why multiply by one in beginning? Why clamp float down at bottom?

It’s working, and thankyou! But I’m curious as to WHY.

My assumption is that clamping is for restricting where camera can look, but I don’t know why this setup works > this one.

http://puu.sh/i3Rdp/59c0a9a1f1.jpg

You are correct, clamp is to restrict camera angle. Removing it would work fine, but give you complete rotation freedom, which is probably not what most people want.

Multiplying by 1 is basically a placeholder. In image you attached, you’re multiplying by BaseLookUpRate instead. This float value simply affects speed with which you can do this particular rotation.