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
0
Question by Reverend-Speed · Aug 14, 2013 at 09:04 AM · charactercontrollerjumpnavmeshnavmeshagent

Are CharacterControllers and NavMeshAgents meant to work together? If so, how?

Currently making a game for the 7DFPS which requires pathfinding and a fast, responsive player character controller.

Running navMeshAgents on the enemy characters seems to cause them to run to and OVERLAP the player character, unless I also use a NavMeshAgent on the PC, as detailed here: http://answers.unity3d.com/questions/247770/how-do-i-stop-an-enemy-navmeshagent-from-intersect.html

However, this introduces a number of new navigation problems - the player can no longer jump, the player cannot enter thin areas of the map and the player often gets stuck on steps. In addition, there is now significant lag between the player pressing a direction key and their avatar responding.

How should I create an FPS avatar for the player which allows me to use the navMesh feature of 3.5-4.2 (enemy characters collide with player, enemy characters navigate map, player character can jump and pass through narrow areas)?

--Rev

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
Best Answer

Answer by Reverend-Speed · Aug 19, 2013 at 07:51 PM

To answer my own question, write a script which sets

 updatePosition = false;

and

 updateRotation = false;

in the navMeshAgent and job done - everything will work perfectly smoothly.

Many thanks to tylo for this solution!

--Rev

Comment
Add comment · Show 2 · 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 imaginationrabbit · Mar 16, 2014 at 11:16 PM 0
Share

Can you please elaborate on this solution as I'm trying to solve the same jumping problem- Do you include that in a script attached to the agent? I would greatly appreciate any guidance- thanks!

avatar image ForbiddenDay imaginationrabbit · Mar 21, 2016 at 04:21 PM 0
Share

Hey @mdotstrange, I have spent a bit of time trying to do what he said, It was a bit confusing but here is a dirty version of it. It sufices enough to reenable the jumping

using UnityEngine; using System.Collections;

public class NavAgentPatch : $$anonymous$$onoBehaviour { public Nav$$anonymous$$eshAgent agent { get; private set; } // Use this for initialization void Start () { agent = GetComponentInChildren ();

     agent.updatePosition = false;
     agent.updateRotation = false;
 }

}

Attach this to the play who has the navagent and character controller and it will make your jumping work again.

avatar image
0

Answer by Doh09 · Sep 09, 2017 at 05:47 PM

I suspect using a NavMeshObstacle on the player would also work, didn't test it though.

https://docs.unity3d.com/Manual/class-NavMeshObstacle.html

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

19 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

Related Questions

How to make AICharacterController able to walk on walls and ceilings? 0 Answers

Navmesh Agent Custom Controller 0 Answers

Player "teleports" on top of NavMeshAgent collider if the Agent is too close 4 Answers

NavMeshAgent Calculate Jump Trajectory 1 Answer

How to jump using a CharacterController and NavMeshAgent 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