Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
0
Question by yahyouch36 · Oct 07, 2020 at 12:17 PM · navmeshagentnavigation

How to reduce the rotation radius in NavMeshAgent ?

When the NavMeshAgent rotates (while going to a destination) , I want it to rotate in-place, or the smallest possible radius . but I can't find that in the Inspector, how can I achieve that ?

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by haliodoha7 · Oct 07, 2020 at 08:55 PM

Getting correct results with the built-in navmesh will be hard, because there's no way to make it have a turn radius. So you'll have to fake it - don't set the destination to be the player, but instead make it follow a set of waypoints that's the semi-circle you want it to move in.

or you could just ask for a navmesh path directly, and follow it without an agent.

In short forum: There's no way to do that unless you do it out-of-box Try reducing Speed ,@yahyouch36 Getting correct results with the built-in navmesh will be hard, because there's no way to make it have a turn radius. So you'll have to fake it - don't set the destination to be the player, but instead make it follow a set of waypoints that's the semi-circle you want it to move in.

or you could just ask for a navmesh path directly, and follow it without an agent. If you're doing that, Aron Granberg's A* project will be more suited to the job, as it's designed for that.

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 Darkc0re · Feb 19 at 11:38 AM

@yahyouch36 I had this exact same issue.. was driving me nuts.. made my character feel sloppy.. SO I found a solution using the navAgent in my code.

Initially, I had a partial workaround, when I had line of sight to the target location, I would do a manual rotation first and then let the NavAgent take over.. with NavAgent.isStopped == True until my rotation check was done and returned a true, then continue walking..

But after doing some research into how the NavAgent worked, I found that you are able to get the next movement location. navAgent.steeringTarget <-- this is the next point it will move towards, So I do a hard turn to this location and then let the navAgent walk.. so from sloppyJoe movement to snappy

So when I handle my click to move I set the navAgent.setDestination to click location, navAgent.isStopped = true, I pass "navAgent.steeringTarget" to the following function, which returns true if facing the correct way. at which point I navAgent.isStopped = false AND it continues the rest of the walk, after moving. you COULD have a check while walking, seeing if the movement angle for a turn is past a set degree and do a snappier turn :)

 public bool RotateToTarget(Vector3 target)
     {
         Vector3 direction = (target - transform.position).normalized;
         float dotProd = Vector3.Dot(direction, transform.forward);
 
         if (dotProd < 0.9)
         {
             Quaternion lookRotation = Quaternion.LookRotation(direction);
             transform.rotation = Quaternion.Slerp(transform.rotation, lookRotation, 0.25f);
             return false;
         }
         return true;
     }

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

142 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 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

NavMeshAgent not fully reaching destination, thus it won't delete itself when it gets there 1 Answer

Get NavMeshAgents (Enemies) to not bunch up together 3 Answers

Can't Give Click to Move to Nav Mesh Agent ?!? 2 Answers

How would I simulate a rectangular Nav Mesh Agent? 0 Answers

NavMesh Components for 2017.4.9f1 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