0
Answered

how to block Player backward movement

Seenu 3 months ago in Game Creator updated by Marti (Lead Developer) 3 months ago 3

I Want my player moves only forward not backward 
how can i block the backward movement Of the player 

Unity version:
2019.3.13f1
Game Creator version:
1.1.8
Under review

Unfortunately this is something that can't be done without coding. However, may I ask in which case you'd not want characters to move backwards? Which input controls are you using?

i am using  Player input system only. in which input type using directional . its like a running and shooting type of game in which player should walk only forward direction he should not go backwards 

may i know where i should make changes to block backward direction 

Answered

You may take a look at the PlayerCharacter class script. You'll see there's a state machine-like that handles input depending on the Input selection. Look at the DirectionalDirection method and you'll see the direction is grabbed using the Input.GetAxis() method. You'll likely want to clamp the Y axis between 1 and 0 (instead of 1 to -1).