• 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
Question by SputnlK · Feb 25, 2015 at 05:53 AM · physicsraycastvehiclewheelsideways

How do i make my Raycast Car not slip at all?

hey,

im trying to make a car with a rigidbody and rays for each wheel.

the car gets vertical forces that are equal to a spring and a damper in real life and they work pretty good so far.

forward movement is pretty simple for now but it works too. the problem is the sideways force. i cant figure out how to add the right force to make the wheels not slip at all.

thats why im asking you to help me. i appreciate every bit of help.

this is what i use to calculate the force that works against the x motion. (dont mind the if's)

 xForce = localHitVel.x;
 
 if (xForce < 0)
 {
 
     body.AddForceAtPosition(transform.right * (xForce - xForceAdd), transform.position, ForceMode.VelocityChange);
 
 }
 if (xForce > 0)
 {
 
     body.AddForceAtPosition(transform.right * (xForce + xForceAdd), transform.position, ForceMode.VelocityChange);
 
 }

alt text

EDIT:

Fixed it... i applied the "Magic Formula" by Pajecka

http://en.wikipedia.org/wiki/Hans_B._Pacejka

http://www.racer.nl/reference/pacejka.htm

xforce.jpg (36.7 kB)
Comment
APProjects

People who like this

1 Show 2
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 APProjects · Aug 09, 2015 at 02:14 PM 0
Share

Hi!

I wonder about your implementation. Did you write a custom suspension script with forces or you're relying on fixed colliders for "suspension" so the wheels don't fall through the road mesh?

How does it work for steering?

avatar image ViFFeX360 · Mar 10, 2016 at 01:52 AM 0
Share

Could you perhaps share how you managed to apply Pacejka forces?

I am really struggling to find a good source of info on it, and every project I've seen so far has done it in a very convoluted way to "simulate" a car, whereas I rather would like a simple implementation that's more like an arcade racer that behaves semi-realistically.

I understand the Pacejka formula itself. I also understand suspension physics, I have made a car that has realistic suspension as well. It even has weight transfer when I hit the acceleration/brakes.

But steering/cornering and sideways force baffle me, I can't seem to wrap my head around it. Considering you managed to find out how to apply it it would be really helpful if you could share the basics :)

Thanks!

0 Replies

· Add your reply
  • Sort: 

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Raycast Car-Vehicle Physics 1 Answer

Creating a magnetic vehicle (like F-Zero) 1 Answer

Vehicle engine RPM without wheelcolliders? 1 Answer

Raycast align with ground normal 2 Answers

Physics.Raycast 2 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