Resident evil tank controls

Hi there, I’ve seen a lot of oold posts about this but all the pictures aren’t visible anymore, so maybe someone would be able to help me : I want to make tanks controls like old resident evil games.

Also, I’ve the camera system but the controls are changing everytime that the camera change. I would like to keep the player direction until he stop pressing a D pad direction (not sure if I’m clear here).

Finally, I’m not a dev at all, just a simple level designer, so if your explications could be followed with pictures, it could very help me.

Thanks a lot :smiley:

Like this? Quick tank controls - YouTube

This is a quick idea just for fun:

  1. For keyboard: create a map <key, bool> to keep track of what keys are still pressed
    – Pressed == true, Released == false.
  2. Loop through the values pf the map searching for true (means a button is still pressed). If found, stop search and do nothing.
  3. Update orientation when all keys are released (all values == false).

How I move the character:

With a controller I think you should check for Axis Value to be 0 or abs(0.##) before updating the orientation.

The Actor that changed the camera is simple, it just checks for character to overlap. I have a component that I can rotate in world space for the orientation to pass to the character and finally set the camera added from the editor viewport.

The “level”… this was fun :rofl:

Hope it helps.

Hey, thanks a lot for your answer !

I’m having some troubles tho, not sure where I’ve to put this stuff. In the Character blueprint right ? Also, I can’t find the “CE Update Hud” block ^^’

This video shows what I mean by “tank control” : UE4 Unreal Engine 4 - Resident Evil 2 Movement/Aim System Alpha WIP - YouTube

Ok… a bit of cleaning should do it…

This is the characters blueprint:


tankChar

You’ll need to enable UserControllerRotationYaw in the character blueprint so it turns with the controller rotation:
image

This is the blueprint to change cameras:

To select the camera actor to change to, you need to reference it in the editor viewport. You can follow this quick tutorial: Referencing Actors | Unreal Engine Documentation
image

tankChar2

In this example the camera does not affect the controller.

2 Likes

I’ve been following what you said but can’t find a way to get your movements, here’s what I got :
Movement

For the cam system, I created a bp in which I’ve put this :


but I guess this is not what I was supposed to do cuz it doees not works ^^

You might have skipped this part.

Nvm I’m just dumb, I needed to change my default pawn class into the project settings; it does works ! :smiley: But I still have trouble with the cameras tho

What kind of trouble?

Idk if I did it right, but when i enter in a trigger, the camera does not change

Could be 1 of two:

  1. In the main viewport outside the blueprint, with the trigger blueprint selected: do you have the option to set the camera like above? Should say Set Cam in your case.
  2. You are casting against the wrong actor. Connect a print node out of the Cast Failed to test.

I have this :
image

I added a print node to the cast failed test and it effectively appears when I enter the trigger

There you go.


You need to change the Test_Movement cast to the class of your character. If you want to go more “global”, cast to Pawn or Character class and all characters should be OK, but would be good to be more specific to the class you are possessing.

Yep it seems to works ! Thanks a lot for your help [T]/

1 Like

Hello, Could you pls do tutorial for us, that would be great for newbies like us :slight_smile:

Thanks for your kind support