Hello
Im a total newbie here, so apologies if this is a stupid question!
I am trying to make and architectural walkthrough with First Person Plater controls.
I am trying to set up First Person Player controls so that when the left mouse button is pressed+ held down, the character moves in the direction that the character is looking.
Whilst the left mouse button depressed:
Moving the mouse left to right = character looks left/right
Moving the mouse forward/back = character looking up/down
On the release of the left mouse button, the character stops moving.
This is what I have so far in the Character’s even graph
This works fine, except when the character collides with a wall or any other obstacle.
This causes the character to stop, which I am ok with. However, when left mouse button is pressed + held again, nothing happens.
You’re taking some great first steps here!
All of this code is ok, I would use a different node than SimpleMoveTo, that’s usually reserved for AI on a navigation mesh. I am thinking a few things and it might have to do with that node.
Do you still have the arms mesh on the character? What else was removed?
Maybe try adding a move backwards? (Same as what you have for left mouse button, put it on right mouse, multiply forward vector x -1 for goal)
I would suggest finding a good tutorial for creating a first person character. There are many out there- you should be able to find something. A quick search brought this-
Or, if you haven’t worked too much on the environment, you could start over with the first person project and simply delete the static mesh component so the arms are gone.
You could also make another project and import the character from that into your current project.
This is something that there are many ways to go about- but if you are attempting with no direction you’re just going to end up with the same thing but a lot slower. Don’t consider it cutting corners- it’s a lot easier to mine with a pickaxe than your hand! Tutorials are tools.
So I have redone the code as per the tutorial, and mapped the forward movement to the left mouse button, but I have not add added the right mouse button mapping with a negate modifier
This is because decided I would like to keep the right mouse button function for looking around when the camera is stationary.
In order to move backwards, I would like to use the right and the left mouse button are pressed simultaneously.
So far, I have made something that looks like this, but I cant figure out how to access the forward vector and reverse it to add it to the end of the True Exec
So that is not going to do the job there. That’s going to trigger on EITHER LMB pressed or RMB released.
You want to use GETKEYDOWN to check, and use an AND on that.
You can probably just use right mouse button pressed as the input, then GETKEYDOWN-LMB and use a branch. Then off TRUE, execute backwards movement.
To get the movement direction, you can simply use the function you have for getting forward direction, and take that yellow vector line and do a “Multiply vector*float” node. Multiply it by -1 and BOOM backwards.
So sometimes, YouTube Tracking is a beautiful thing:
I spent all night looking for a tutorial / video to help solve this problem with no luck. And this morning, at the top of the you tube landing page was this video: https://www.youtube.com/watch?v=kXaI3qblpMo which elegantly solved the problem!