Minimum distance movement


Does the player class possess an attribute for minimum distance movement ?

I explain what I want to do. My character in first player view will be allowed to move like in the Daggerfall game, or Etrian Odissey, or Dark Spire for example. Understand that he will move one world unit each time the player hits a button.

When there is a wall near my character, for example on his left, hitting the left button should not make the character move, because the wall is nearer than one world unit. I am trying to implement that thanks to the CapsuleCollisionShape, but there is always a small space between the player capsule and the wall. I don’t want the character to move to that small space.

To be even more clear, think that my character is on rails. If there is a corridor, he can only go forth and back. If there was a minimum distance movement, the character could not approach the wall on his left.

I don’t want to implement that by checking existing obstacles each time the character wants to move. I want to use collision detection.

Thanks for any answers !

how about you make the walls as physic boxes, and make them have bigger size, e.g a wall of size 2.5 (appearance) will have a box (physics/collision) of size 3 (thus preventing smaller movements - the 0.5 extra).

Alternative how about not using physics at all, just use a plain “grid” (e.g a java array[x][y] where allowed movements are an increment of 1).

I have tried to design the level so that my capsule can pass between the walls without any extra space between the capsule ans the wall but it did not work.

There is always an extra space, or the capsule is too big to walk between two walls.

Physics is usually not meant for grid movement, I suggest using your own movement logic.

Yeeh, it sounds like physics is overkill in this case…