Forum rules - please read before posting.

Prevent moving outside of the navmesh

Hi there,

Is there a way to prevent the player character from moving outside the navmesh?

I'm currently using the Point and Click movement method for my 2D game. In one scene, there's a floor sprite at the bottom of the screen equipped with a navmesh. My player character initially spawns on a windowsill sprite that doesn't have a navmesh. If I click anywhere on a wall, the player character starts walking downwards towards the floor sprite.
I placed CollisionCube2D on the wall around the windowsill sprite, but unfortunately, it didn't bring about any changes.

I tried placing a CollisionCube2D on the wall surrounding the windowsill sprite, but it didn't bring about any changes.

I'd appreciate any guidance on how to address this issue. Thanks in advance.

<Interface/Movement settings & NavMesh2D Inspector>
https://imgur.com/a/rkaF2Ff

Comments

  • When using Point And Click movement, the Player will always try to move on the NavMesh.

    If they aren't on it, they'll assume this is a mistake and will attempt to get back on it.

    If you want the Player to temporarily be prevented from moving, you can use the Player: Constrain to disable their Movement ability.

  • Thank you so much!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.