Search Unity

Resolved Stop navmesh agent from going z axis with Bolt

Discussion in 'Visual Scripting' started by Dudusstar, Dec 17, 2020.

  1. Dudusstar

    Dudusstar

    Joined:
    Nov 19, 2020
    Posts:
    59
    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
    game.PNG

    like this

    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 rotation_constraint.PNG


    Thank you for your time and patience!!!

    Noob Rookie Game designer Edu
     
  2. Dudusstar

    Dudusstar

    Joined:
    Nov 19, 2020
    Posts:
    59
    I've finally got a solution. Really dumb as question becasue I just had to add a restrinct position component!!
     
    AloneSyndrome likes this.
  3. Dudusstar

    Dudusstar

    Joined:
    Nov 19, 2020
    Posts:
    59
    Wow! You are clever! Nice!
     
    tomosbach likes this.
  4. tomosbach

    tomosbach

    Joined:
    Feb 25, 2021
    Posts:
    7
    I DEFINITELY DIDNT ALSO JUST RESTRICT THE ROTATION THEN GOOGLE HOW TO RESTRIC THE POSITION
     
  5. Sammonius

    Sammonius

    Joined:
    Mar 18, 2017
    Posts:
    8
    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?
     
    Garien, jlively and DaniyarGilymov like this.
  6. Garien

    Garien

    Joined:
    Oct 11, 2018
    Posts:
    36
    Same here, haven't found a solution yet. Were you able to solve it?
     
  7. mehmetyavuzyogitoglu

    mehmetyavuzyogitoglu

    Joined:
    Jun 23, 2022
    Posts:
    1
    You Can Use the 2d PathFinding Ai,I learned in 1 day its easy.

    PATHFINDING AI : https://arongranberg.com/astar/
    Tutorial: