Character always faces camera direction in tank control + fixed camera blueprint

I tried a few of the answers to similar questions I found here but I couldn’t make it work.

I have implemented tank controls which make the character rotate left and right if A or D or ← or → directions are pressed but the issue is after about 1 second, the character keeps snapping to the direction the camera is facing.

Blueprint for tank controls:

Initial character position

Character direction after about 1 second

Note: I found that by removing this node the snapping issue stops but that also controls the character rotation so…any help would be appreciated.

Perhaps this will explain better: Tank controls 01 - YouTube

Notice how the character’s direction keeps reverting to where the camera is facing when I rotate it. Yes, I did try checking / unchecking those options but it made no difference.

So you want the character to move left and right, but the camera to not stick to the back of the character? I’m unclear on how this is different from the base third-person set up that usually comes with the premade. Shouldn’t it already be doing those things?

Did you change the “Use Pawn Control Rotation” in spring arm or the “Use controller rotation yaw” in class defaults? Those things usually mess with the camera a lot.

Well, I played with it for a bit, and I don’t know how to fix it either. Sorry.

Question, so you experienced the same snapping issue?

Sorry, I’m still really new to unreal engine. Where is the controller settings you’re referring to?

Note that there are two different Get Control Rotation nodes … one for the pawn and one for the controller. You can get and set the controller rotation and lock the pawn to that, or unlock the pawn from the controller and set the pawn’s control rotation directly. If you try to set a pawn’s control rotation but its locked to the controller, it will likely snap back and forth. Try a different combination of these two nodes and see if you then get the desired effect.

Another thing to try is to go into your Player Controller and search for the “Attach to Pawn” checkbox. This can help keep the controller and the pawn synced up in 3D space/orientation which might make your math work out better as well. [This is really handy when doing 6DOF style games].

329213-attach.jpg

If you don’t have your own Player Controller for your character yet, then right-click in your Content Browser and pick Blueprint Class, then pick Player Controller. You will find this Attach to Pawn option in there. This is a handy place to add input logic if you want to have several different pawns later down the road that all move the same way instead of copying your code into individual pawns. You can also store variables in that which will stay put even if the Pawn is killed and respawned etc. Next you’ll want to create your own Game Mode which is how you tie your pawn to your player controller. For that, right-click in your Content Browser and pick Blueprint Class again, but this time do a search in the All Classes dropdown for GameMode and choose that. [Dont use the GameModeBase button, just trust me for now]. In your own game mode, you can set your pawn and your custom player controller to work together. Last step is to go on your map and go to Windows → World Settings. Under the Game Mode section, you can override to use your custom game mode, which will bring in what pawn you want to spawn and with what player controller. (You can also set the game mode up here once you’ve made one). These are the basic steps to get all the different pieces running together. It’s not a super obvious thing for beginners to know but is the right process.

No, I couldn’t even reproduce the problem. It seems like someone else helped you though, so good luck with your game. :slight_smile: