Hi there, whenever I go into play mode and look upwards the characters movement slows to almost to a halt, (this happens when I look down). The slowing of movement happens only when I move the forwards or backwards ( W key or S key) however If I move left to right ( A key and D key ) the speed of the character stays the same ( as if I was looking straight)
What you’re seeing is a result of Get Forward Vector being connected to Get Control Rotation. If you open up the MyCharacter Blueprint, you can see what I’m talking about; the InputAxis MoveForward node is attached to the Add Movement Input node, which in turn grabs the forward vector according to the Pawn’s rotation. The problem is that when the player aims down or up, the forward vector is not aligned with the x axis (as Get Right Vector is, as you already pointed out).
To the left of the Movement Input section of the MyCharacter Blueprint is the Mouse Input section. The InputAxis LookUp node is attached to Add Controller Pitch Input. The problem with that is we don’t want to rotate the entire Pawn because that adjusts our forward movement. Rather, we just want the camera and arms mesh component to rotate.
So how do you adjust this? Let’s disconnect the InputAxis LookUp node from the Add Controller Pitch Input. Then, set up the following:
What we’re doing here is setting the relative rotation of a component of the pawn instead of the whole pawn. In your Components tab, attach your FirstPersonCamera component to Mesh1P, and attach Mesh1P to Mesh.
Now when you move the mouse up and down, you’re just rotating the arms mesh and camera component. The rest of the nodes we’re using are clamping the rotation so you can only look up and down to the 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 the Pawn rotation. Since we’ve disabled rotating the whole Pawn up and down, the projectile will only fire straight forward on the x plane. To fix this, adjust the following in the Spawn Projectile section of the MyCharacter Blueprint:
We’re just replacing the Get Control Rotation node with a Get World Rotation of the Mesh1P component. Play with the settings for Gun Offset vector node if you want to make the shots more accurate.
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 the default Blueprint is very simple.
The 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 the issue using Blueprints. The default setup includes a very simple, easier to understand Blueprint for forward motion, but it has the problems I listed above because it is so simple. Try out the changes I suggested and it should give you more control over how your character moves in your project.
I’m having the same issue and am trying to setup my LookUp input the same way Ben has it in that first picture, but I cannot find the Target to Relative Rotation node? I’ve searched ‘Relative’ with context sensitive off but no luck.
Are you doing this inside your character Blueprint? When you drag off the InputAxis LookUp node and type in Relative, there should be four options including the one we’re looking for: “Set Actor Relative Rotation.”
Sorry I wasn’t more clear, I see now there are two nodes in that image with the words 'Relative Rotation;. I am able to find the ‘Set Relative Rotation’ node but not the smaller purple node that has just the target input and relative rotation output…
Nvm, I just figured it out as I was writing this. I was trying to find the ‘Get Relative Rotation’ node without pulling from ‘Get Mesh’ first.
Hi Ben, Thanks for the help on this as it was driving me crazy for a bit but it seems I’m not out of the woods yet.
I’ve got this set up like you have above but the camera is not rotating correctly with the 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 the fix and I’m getting the same thing.
[Quick Video Link][1]
Fixing the projectiles worked fine but I did not set this up yet when I recorded the 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 the help as always.
You are correct, the clamp is to restrict the 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 the image you attached, you’re multiplying by BaseLookUpRate instead. This float value simply affects the speed with which you can do this particular rotation.