• 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
1
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
Add comment · 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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

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

Vehicle engine RPM without wheelcolliders? 1 Answer

Raycast align with ground normal 2 Answers

Raycast Car-Vehicle Physics 1 Answer

Raycast not working 2 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges