Forward/Back input movement instead of Axis
I want to try and create an old school First Person dungeon crawler similar to old school games. An example is https://youtu.be/EV28-iHbISU?t=10m Except replace clicking on screen prompts with WASD.
If the video is not obvious or you cannot watch the video the movement system I want to implement is: - Pressing W or S will translate you forward/back X amount of units. - Pressing A or D will rotate you left/right 90 degrees
Right now I have my rotation working
(I am aware that a lot of stuff can be connected so it looks cleaner, just haven't done it yet. However if you know a more performance efficient way to do it I should know, that'd be helpful.)
However my forward/back blueprint is not working
The issue that comes up is weird results coming from actually pressing the input. The timeline goes from 0 to 40 and the start location is at 100.
If I press W 4 times it'll go
The other issue that will show up later is the way my blueprint is set up now, if I rotate my camera 180 degrees I will essentially move backwards if I press W. Is there a better solution than making a branch with 4 variables for each rotation (90, 180, 270, 0) and change X/Y depending on which variable is checked?
Are you using a timeline or matinee for this? The blueprint looks odd to me:
I don't recommend using "SetRelativeLocation" as this sets a local position I believe. You'll want to inerpolate between your new location and your old location to get a smooth transition but if you don't care about that, setting world location is fine. The other issue you're going to have is setting your location relative to your camera orientation.
Should look more like this i think: (wasn't able to test this one)
This does not solve rotation, but that is handled by:
Hope that helps! Good luck!
answered Apr 10 '16 at 12:31 AM
GetActorForwardVector and GetActorRightVector
E: I see you are moving a FirstPersonCamera around manually. I was doing similar with a 3rd Person Camera and found it awkward. It is much easier to use a Pawn(or Character) class to deal with movement in the world. You can then attach a camera to that class and set the relative location (eye height for example). This is how the editor camera works for example.
Follow this question
Once you sign in you will be able to subscribe for any updates here