Third Person 'Survival' Camera - Issue With Strafe Whilst in Default Cam

Hi, I’m currently building a Blueprint prototype for a Third Person ‘Survival’ cam, much like what you’d see in games like The Last of Us, Dead Space and so on. I’ve got the camera functionality and the zoom in mode all working, but I’m having a problem where I can’t get the player to strafe, but still orient ‘orient rotation to movement’.

Basically, what I’m trying to achieve is this:

  • When the player uses the WASD/Left Thumbstick to move, the character moves, but always facing in the direction of the camera. So for example, if you went left, your character would strafe left.
  • The Mouse/Right Thumbstick controls the camera. If the character is not moving, the camera will simply spin around the player (without affecting the character rotation). However, as soon as you attempt to move the player, the character rotates to face the camera, using the camera’s face direction as ‘forward’.

So as I mentioned briefly at the top, I’ve got all this working, EXCEPT for the player strafing whilst in the normal camera. Instead, the character turns to face the direction he’s walking. I have tried turning off ‘Orient Rotation to Movement’, which does make the character strafe instead of rotate, but this then stops him rotating all together. The way I thought of fixing this was to update the player rotation when there is movement input triggered, but this just makes the character always face the camera.

If anyone knows of a solution, where I’m going wrong, or a better way of doing this, I’d be extremely grateful if they could let me know. I’ll post what I’ve got so far below, and just to re-iterate, I’m doing this in Blueprints not C++ :slight_smile:

Many thanks!

Ok so my prototype is based on the Blueprint Third Person example. Everything below is part of my Character Blueprint.

In Defaults, I have ‘Orient Rotation to Movement’ ticked at the start, and in my components, I have my default camera, along with two Scene Components to define where I’d like my camera to move (for zoom in/out).

This is my Movement Input, which is basically as it came, only I’ve made the ‘Set Actor Rotation’ dependant on whether I’m aiming or not (this is because I want the character to rotate with the cam whilst aiming).

These next two images are more for my Aim setup (which works fine), but I’ve included them anyway in case there’s something I can do in here, or if anyone else struggling with how to do an aiming mode wants to use this formula.

68c0933c55fe9f8e93f6b1bfa7a51b0ff59bbfdb.jpeg

Apologies to anyone wanting to use the zoom feature if its not very clear, I’m using this thread more to solve my current problem. If you have any questions though please feel free to post them and I’ll try to answer. If I can get all of this set up and working nicely, I’ll try and put up a proper tutorial for all this.

I’ve tweaked this so that now the rotation of the actor only updates when the character is being instructed to move (see blueprint below). The problem I’m having is blending the character, as he now snaps to the new rotation. I’ve tried using RInterpTo and so on, but either its not working, or I’m not doing it right.

ae61d3ae99133ed64f49f6f87ac1bf62e7832cd1.jpeg

Would anyone mind showing me a correct way to have the character rotation blend between its current direction and the camera direction?

Thanks.

I’m looking in doing the player control the same way (aka old school strafing) and I’ve come to the conclusion that doing it all in blueprints as a single event is going to be a bit awkward and getting all of the blending to work right difficult to maintain.

What I’m thinking and in the process of doing is to use a blend space, not blend space 1d as in the example file, and build up the motion based on the 8 possible axis using the center as the fixed idle position.

Currently at the 50% point will be a blend to walking and moving to 100% will be full running and it’s all working as a simulation and the next step is to figure out the binding by keyboard and normalize the the output value to either 0 > 50% or 0 > 100% based on an absolute as to the player walking or running.

What I’m also thinking is at the moment the x/y division is set to 4 so by going 5X5 I could put in the crouching, if I go 6X6 I could included swimming, 7X7 add jumping and so on and so on.

Personally I believe that this is the logic of the blend space in general and can maintain all of your key moments with in this space and trigger the motion by setting x/y label as a variable as to direction and speed.

Yeah the biggest problem seems to be getting everything working together seamlessly, but something like that sounds like it’d be great, especially further down the line when more movement functionality is introduced.

I don’t have Unreal currently to hand, but could you not change the values in the axis input to 0.5/-0.5 for your walking button, then 1/-1 for your running key? Alternatively, I may be trying to over-simplify it, but what about just your classic ‘Walk/Run’ Action inputs that move between two speeds? If you’re only after the 50% and 100% values, that should in theory give you your keybinds?

It’d be great to see if you manage to get this working properly anyway. I’ve been looking at various third person games to see how their camera systems vary and this is the only one I haven’t managed to get working the way I’d hoped. If all else fails I can always resort to one of those for future ideas, I just don’t like to be beaten by this sort of thing :stuck_out_tongue:

Hello, if I understood this correctly all you want is to able to strafe without the character orienting to the movement direction, as well as using the camera to turn the player?
Luckily, that is pretty easy to do, just set “Use Controller Rotation Yaw” to **true **and “Orient Rotation to Movement” to false.

This is how to set the variables from within a **PlayerController **blueprint:

http://imageupper.com/s02/1/6/H1398565209648450_1.png

Sure, you can use the “RInterp To” node to achieve that effect.
Jeff Ferris wrote an inspiring article showcasing what can be achieved with interpolation,
be sure to check it out: https://www.unrealengine.com/blog/the-subtle-magic-of-interpto

Here’s a beginner friendly introduction to linear interpolate, and how to make use of it in the material editor:
Starting at 13:30 http://youtu.be/sIMmDVLqh1s?t=13m30s

There’s also an awesome video over at YouTube explaining linear interpolation in more depth:
https://www.youtube.com/watch?v=0MHkgPqc-P4

An example for use in your **Character **blueprint:

http://imageupper.com/s03/1/8/U1398566632641273_1.png

Or, if you prefer, here’s a **PlayerController **blueprint which does the exact same thing:

http://imageupper.com/s03/1/8/U1398566632641273_2.png

Notice that I used Get Actor Transform rather than Get Actor Rotation.
For whatever reason I’m unable to get the actor rotation node while inside a PlayerController blueprint, which seems to be a bug in 4.1 .


I also feel like I have to mention that most (old-school) Third Person games do not interpolate the player rotation to the camera rotation, rather the other way around.
This is how I’d go about adding a subtle, eye-candy smoothing effect to the camera:

Building upon the Third Person tempate ,

  1. Make a new variable named DesiredCameraRotation, of type Rotator

  2. Change the “InputAxis Turn ==> Add Controller Yaw Input
    to “InputAxis Turn ==> Add AxisValue to DesiredCameraRotation”.
    Optionally, multiply the AxisValue by 2 to get the default camera speed.

  3. Add a tick event to handle the rotation:
    **Tick **==> RInterp To, between Control Rotation and DesiredCameraRotation ==> **Set Control Rotation **to the return value of the RInterp.

I’ve done it! :smiley:

Thanks Real, what you suggested at the start isn’t quite what I was after… That behaves in a similar way, but more like your classic over-the-shoulder game like Gears of War and Resident Evil (unless I just didn’t quite do it right). What I was after was if the player is moving, then use the camera to define the character rotation. If the player is not moving though, the camera should freely rotate around the player. HOWEVER! it was your RInterp To that I was missing, and now it works great!

I’ll tidy my Blueprint and then post what I’ve got in case anyone would like to use it in future :slight_smile:

Thanks again to you both!

Both of these segments are inside my Character Blueprint:

7b1c73e32b7fe3434ece51e46c42ca3e456f3bcc.jpeg

35e1d60b927a9aa18a409fd9fa178a766a55391f.jpeg

Hey Scourged_Wolf, thanks for this. I was looking for a way to do exactly the same type of camera setup!

Sorry for “necroing”, but I just found this topic:

I pretty much followed what Scourged_Wolf did and “copied” the BP he posted in his last reply. Somehow my Actor still faces to the left and right if I just move. The Actor only faces forward and strafes, if I press RMB for the Aim Check. Did some DB Debugging, but I am somehow completely clueless on what the problem might be.

Can someone help?