• 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 EvilTak · Dec 16, 2014 at 01:17 PM · aisteeringvehicles

Most Efficient Method for Steering for Vehicle AI

Hi Unity Community!

Any tutorial regarding ve$$anonymous$$cle AI gives the following code for getting the steering magnitude (-1 to 1) to the next waypoint:

 Vector3 pos = transform.InverseTransformPoint(nextWaypoint.position);
 steerMagnitude = pos.x / pos.magnitude;

But since t$$anonymous$$s involves the Sqrt operation, is there a more efficient method? Because I plan on having about minimum 50 ve$$anonymous$$cles in the scene at a time. But that can even increase to 100 - 200 ve$$anonymous$$cles. Or is the Sqrt operation fast enough for mobile devices to cope with 200 ve$$anonymous$$cles using t$$anonymous$$s code each FixedUpdate? I also have other code like OA, etc.

Comment
Add comment · Show 3
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 Owen-Reynolds · Dec 16, 2014 at 04:12 PM 0
Share
avatar image EvilTak · Dec 20, 2014 at 05:21 AM 0
Share
avatar image EvilTak EvilTak · Jul 11, 2016 at 07:39 AM 0
Share

1 Reply

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

Answer by tanoshimi · Dec 16, 2014 at 02:15 PM

What's your fixed timestep? I t$$anonymous$$nk the default is 0.02, but there's no way when I'm driving I adjust by steering 50 times a second.... if you need to keep the timestep that $$anonymous$$gh for other calculations, then don't recalculate the steering magnitude in every FixedUpdate() - put it in a coroutine, say, that runs less frequently.

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 EvilTak · Dec 16, 2014 at 02:32 PM 0
Share
avatar image tanoshimi · Dec 16, 2014 at 04:18 PM 1
Share

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

28 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

Related Questions

edys vehicle physics car steer to target 0 Answers

NPCs random movement 2 Answers

Turning an object towards point 0 Answers

Determining rotation for collision avoidance? 3 Answers

makeing enemies 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