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
2
Question by Instinct · Mar 18, 2015 at 01:58 PM · ainavmeshnavmeshagentpathfinding

Possible to edit the movement of NavMeshAgent ?

Hello!

I am fiddling with my first pathfinding behaviour. I am using a navmesh and the built in NavMeshAgent and it works great so far!

But I want the agent to take a wider, curved turn (because the agent-object is a vehicle) [Check the illustration below to see what I mean].

If I could edit the navmesh properties at some extend or even create my own navmesh agent, I could say that the agent can only go forward and Slerp the rotation towards the target.

Does anyone know of a editable NavmeshAgent template code??

Or have any other good tips on how to get the navmesh-agent to do a wider curved vehicle-like turn/rotation?


What I have tried:

  • A empty gameobject with the unity NavMeshAgent component that goes towards a destination target

  • A object with the vehicle model and a script saying it should only go forward and rotate towards the navmeshagent (this creates a nice and wide vehicle-like turn/rotation)

But the problem with this is that vehicle-object goes of the navmesh and collides with obstacles, because it takes a wider turn than the navmeshagent.


Illustration showing how the NavmeshAgent turns at the moment VS how I want it to turn:
alt text

Thanks for any kind of help!

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 UNZoOM · Mar 19, 2015 at 10:53 PM

 This js should work.
 Attach it to the nav mesh agent ( your car ) and it shall serve the purpose.
 To make it smoother play with the nav Agents ( Angular speed value ).
 
 targets is an array of Transforms where you can plugin the waypoints.
 currentTarget can be your 1st way point ( targets[0] , or you can drag in the inspector )
 navigation is your NavMeshAgent.
 
 
 public var currentTarget : Transform;
 public var targets : Transform[];
 public var navigation : NavMeshAgent;
 var incr:int;
  
    
 function Start ()  
 {       
   navigation.destination = targets[i].position;   
 } 
  
  
 
 function Update () 
 {   
     var dist = Vector3.Distance(targets[i].position,transform.position);
     currentTarget = targets[i]; 
     if (dist < 5){     
 
     if (i < targets.Length - 1)
         {   
              i++; //change next target
              incr++;
              navigation.destination = targets[i].position;   
              
          }
     }
 
 }

Comment
Add comment · Show 1 · 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 Instinct · Mar 20, 2015 at 03:02 PM 0
Share

But that only searches for the next waypoint, right?
I am afraid that does not solve my problem, as I know how to search for waypoints. Thanks for trying though :)

avatar image
0

Answer by 10yaseen1 · Aug 29, 2015 at 02:47 PM

I am not sure if you still need a answer to this but how about using RotateTowards

method? It works rather smoothly for basic humanoid characters as far as I have noticed, might work with a car as well, although I don't think creating a car AI that way would do any good.

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

22 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

Related Questions

Horde of NavMeshAgents - stops to recalculate path. 4 Answers

Find the closest point of an Invalid or Partial path 0 Answers

Navmesh agent stuck on partial path 0 Answers

How to build a custom shape NavMesh Area 1 Answer

Connecting two navmeshes without "Speedboost" 0 Answers


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