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 noodlz · Jul 02, 2013 at 11:55 AM · collisionaicarwaypointspline

Check whether car has passed a point in world space

Hello!

I'm developing a racing game and currently working on a reinforcement learner for my car AI. I got it working for an early version of my car prefab (had a fairly slow top speed of 60mph).

I have since updated my car prefab to have a higher acceleration and top speed (now 120mph).

Now for the problem:

The car is driving around the track based on points on a spline generated from several waypoints positioned around the track (throttle and steering values are learned over thousands of iterations between each point on the track).

This worked fine for the first prefab which had a relatively low speed; I was checking the magnitude of the vector between the car and the point and if this was under a threshold (ie 2.0), then move on to the next spline point.

Now the car is at a higher speed, however, this check is sometimes skipped as the car moves past it too quickly. As such it ends up crashing as it is still trying to steer/throttle towards the point.

I'm struggling to think of possible solutions to this. One potential one I came up with may be to create simple box colliders at each spline point with continuous dynamic collision detection and use that to check if the car passes through it, but I feel this may be a bit of a hacky solution.

Does anyone have any suggestions/encountered something like this before?

Sorry for the wall of text :)

TL;DR: Car moving too fast to check if it has passed through a point on a spline, how can I test for this better?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Oana · Jul 02, 2013 at 12:51 PM

The collider solution sounds quite good actually. It was just what I was going to suggest based on the title.

As for sticking to the original spline idea... well, do you need to compare it to just those determined points? Assuming you have a whole spline structure in place and you can just extrapolate any point, wouldn't it work to check what the closest point to the car is, and then moving the car towards a point that is a set distance along the spline? (Maybe increase this set distance based on speed)

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 noodlz · Jul 02, 2013 at 01:38 PM 0
Share

Yeah I'm in the process of trying the collider method now, if that proves to work well I may just stick with that. $$anonymous$$y main concern is if theres much of a performance hit using so many colliders?

If not your proposed alternative sounds like it would work, though definitely require a large amount of reworking in the code.

$$anonymous$$any thanks for your help!

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

16 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

Related Questions

How To Add AI To Car/Racer? 4 Answers

Car- can someone help me convert this to C#? 1 Answer

Steering an AI vehicle to a waypoint using float of -1 to 1? 1 Answer

Cars in City 0 Answers

Can not get value out of a collision 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