Resume Player Movement after Collision

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.

Can anyone explain what I can do to fix this?

Thanks!

Hey @MegaShiShi! Welcome to the forums!

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)

Hello

Thanks so much for your advice

I will try a different node - do you have any recommendations?

I started from scratch with the characters so I don’t have the arms mesh, only a camera with a spring arm.

Ill also try the move backwards and let you know how that works out.

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. :slight_smile:

Thanks!
This is super helpful!

1 Like

Hello again

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

I know there is probably a very simple way to to this, but being a newbie, I have no idea what it is.

If you have any recommendation I would be super appreciative!!

Thanks

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. :slight_smile:

So that is not going to do the job there. That’s going to trigger on EITHER LMB pressed or RMB released.

Oh yeah, I totally didnt notice that I was using the Released Exec, I meant to use Pressed

You want to use GETKEYDOWN to check, and use an AND on that.

I cant seem to find GETKEYDOWN - can you explain further?

Sorry, it was changed to “IsInputKeyDown” at some point since I’ve last done this.

image

are you suggesting something like this? (which I doubt because its giving errors as the Left Mouse Button needs to be connected to something)

Or this, which is similar to what I started with - but still doesn’t work:

These don’t work either, for the record

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!

The solution is a Chorded Enhanced Input Action:

Took 5 mins!

Thanks for your help on this anyway!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.