Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by laradov · Dec 06, 2012 at 09:48 AM · navmeshnavigationpathagentbackward

NavMesh Agent rotation problem

I bought a character pack with animations. I am using NavMesh Agent components for path finding but when I set destination and play, agent turns backwards and start walking backwards (like Moonwalk). I used lots of different characters with NavMesh Agents before but this is the first time I am in this kind of trouble. I tried all kind of rotation options (with coding or manually) but didn't work.

In other words, is there a way to change NavMesh Agent face rotation?

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Girum_Tibebu · Jan 01, 2013 at 01:32 PM 0
Share

I've also faced a problem with the direction of the navigation while applying the navmesh agent to a gameobject with mouse look script attached.

avatar image Tlasol · Jul 04, 2013 at 01:55 PM 0
Share

Please, help, I have the same problem. Is there any way to change through scripting or smth, 'cause I have no way to fix the fbx model myself.

4 Replies

· Add your reply
  • Sort: 
avatar image
6
Best Answer

Answer by laradov · Jul 04, 2013 at 03:02 PM

I am answering my own question :) This is how I solve it (I think it is not a good solution but it works) ; Create an empty game object ,add NavMesh Agent component (and scripts if you have) and put the model inside it in reverse angle(set the model position as (0,0,0) and rotation as (0,180,0) or the axis you use). In fact you are controlling the empty object but since the empty game object is invisible, it looks like you are controlling the model.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image vaidyanathpanagar · Dec 25, 2015 at 05:40 AM 0
Share

works perfectly. Thank you.

avatar image Erwin-Broekhuis · Jan 07, 2017 at 10:42 PM 0
Share

This is good practise in general.

avatar image SuperSander · Sep 07, 2018 at 08:05 AM 0
Share

This doesnt't seems to work for me :/

avatar image umair612 · Oct 18, 2019 at 06:11 PM 0
Share

This solved the issue. To think I halted development for 4 months because. Is this a bug in navmeshAgent?

avatar image
0

Answer by Tlasol · Jul 04, 2013 at 03:24 PM

There's another way :) Found it.

Depends on your model, but there is a way to transform rotation of Y to 180 degrees on one or another layers. Still there may be a problem with pivots, which causes offset from center of navmeshagent, but it's okay and easy to fix with 'position'.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Johnad194 · Jan 28, 2019 at 11:45 PM

A little late, but you could always export the model to blender or your choice of 3D modelling software and rotate it there. I personally prefer this method to having as many nested GameObjects in my hierarchy.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by kami1339 · Apr 03, 2019 at 08:18 PM

SOLVED 1 Make an empty object 2 put your object in to your empty object 3 set all your rotation"s object to 0(zero) 4 rotate your object and test navigation!

Testing

A- choose your empty object and ad thsi companent to it companent>navigation>navigation mesh agent. B- add this script to your empty object.

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.AI;///////////////////important
 public class playernavigation : MonoBehaviour {
     public GameObject target;
     public NavMeshAgent navMeshAgent;
 
 
     void Start () {
         navMeshAgent = GetComponent<NavMeshAgent> ();
     }
     
     // Update is called once per frame
     void Update () {
         //GameObject.Find("Cube").transform.position;
 
         navMeshAgent.SetDestination (target.transform.position);
             
         }
 }
 //navMeshAgent.SetDestination (new Vector3(x,y,z));

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to queue NavMeshAgents on entering a tile in Unity (based on path distance to tile)? 0 Answers

Making NavMesh areas? 0 Answers

NavMeshAgent collision not working with player 2 Answers

How to prevent NavMeshAgents from colliding when warped to same position? 0 Answers

Is it possible to store NavMeshAgents paths and assign them to other NavMeshAgents later? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges