Stop navmesh agent from going z axis with Bolt

Hi everyone!! So I’m creating a 2d cenital view game and I’m using the NavmeshPlus asset and my navmesh agent tends to rotate and move into the z axis.

The wolf sprite moves into the z axis

like this

6633328--756529--z_position.PNG

how can I set and update to set the z axis to 0

I’ve solved the first rotation issue by adding a constrinct rotation component (image attached) but I don’t know how to prevent it to going into the z axis and dissappear.

Rotation constraint

Thank you for your time and patience!!!

Noob Rookie Game designer Edu

I’ve finally got a solution. Really dumb as question becasue I just had to add a restrinct position component!!

1 Like

Wow! You are clever! Nice!

1 Like

I DEFINITELY DIDNT ALSO JUST RESTRICT THE ROTATION THEN GOOGLE HOW TO RESTRIC THE POSITION

Hi,

For me It doesn’t work. I cannot set the z position to 0. I have tried a lot of things…

  • Position Constraint
  • Base Offset to 0
  • agent.updateUpAxis = false;
  • setting the z position to 0 in the Update method…

No result… z is still not 0. It’s -0.02499892.

It’s ridiculous. I spent a couple of hours with this. I could write the code instead to move the agent in half this time…

Does anybody have a solution for this super simple looking problem?

3 Likes

Same here, haven’t found a solution yet. Were you able to solve it?

You Can Use the 2d PathFinding Ai,I learned in 1 day its easy.

PATHFINDING AI : https://arongranberg.com/astar/
Tutorial:
https://www.youtube.com/watch?v=63zWZ2rJZ68