• 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 HolBol · Jul 14, 2010 at 05:41 PM · velocitycarfrictionwheel-colliderslip

Decreasing wheel friction with velocity

I want to have my car wheels to have less sideways friction at higher speeds, how do i do this? this is the code i have so far... but it doesn't work.

var slip = 0.022 - (rigidbody.velocity.magnitude / 150);

BackRightWheel.WheelHit.sidewaysSlip = slip;

Comment

People who like this

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

Answer by spinaljack · Jul 14, 2010 at 05:50 PM

I'd change your code to:

var slip : float;

BackRightWheel.sidewaysFriction.stiffness = slip;

Also I'd clamp the slip value to make sure it never reaches 0 or some other minimum value.

To use math clamp you do this:

slip = Mathf.Clamp(slip,min,max)

or

slip = Mathf.Clamp(slip,0.001,0.022);

If you wanted a smooth curve instead of a linear line you can use this formula instead:

slip = 0.001 + 0.022/(rigidbody.velocity.magnitude+1) 
Comment
dingben
Bravini
Dubious-Drewski

People who like this

3 Show 8 · 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 HolBol · Jul 14, 2010 at 08:00 PM 0
Share

Doesn' work... i get an error of : Assets/PlayerCar_Script.js(49,16): BCE0019: 'WheelHit' is not a member of 'UnityEngine.WheelCollider'.

avatar image spinaljack · Jul 14, 2010 at 09:09 PM 0
Share

That part's your code... Just delete that part

avatar image HolBol · Jul 14, 2010 at 09:12 PM 0
Share

AHHH so it is, woops.

avatar image HolBol · Jul 14, 2010 at 09:36 PM 0
Share

instead of this: var slip = 0.022 - (rigidbody.velocity.magnitude / 150);, is there a better way to reduce it, but not too far? cos this goes into minus numbers.

avatar image spinaljack · Jul 14, 2010 at 10:16 PM 0
Share

edited my answer

Show more comments

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

No one has followed this question yet.

Related Questions

Detecting how much force is needed to bring a rigidbody's velocity to zero 1 Answer

Turbo Functionality 1 Answer

How to make a car move with a plane? 0 Answers

Getting contact force between two rigidbodies 1 Answer

Car "burns rubber" 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