• 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 SuperProgrammer · Jan 22, 2014 at 11:37 AM · c#customwheelcollidersuspension

Custom Wheel Collider Suspension

I am trying to make a Custom WheelCollider but i have a few problems.

float SuspensionForce = SuspensionSpring * (m_suspensionCompression + m_suspensionCompressionPrev) / 2 + SuspensionDamper * (m_suspensionCompression - m_suspensionCompressionPrev) / Time.fixedDeltaTime;

  1. Damper cause vibration, High damping = High Vibration

  2. System never getting stable

  3. Is there a way to limit max compression?

  4. Is there a way to sleep rigidbody when its stable? As i know, applying force will wake it up.

Help! What should i do for a realistic Wheel?

m_suspensionCompression unit: meters

SpringForce = SpringCoefficient * compressiondistance;

DampingForce = DampingCoefficient * compressionspeed;

Currently compression calculating form raycast hitpoint.

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 HappyMoo · Jan 23, 2014 at 05:18 AM

The DampingForce is supposed to act against the Suspension force. Have you checked that they don't have the same sign and add up? Is your SuspensionDamper negative?

Also if that Damping doesn't work out, you could simulate one step further, meaning calculating a speed from the force and then simply implement the damping by doing something like this:

 damp=0.99;
 speed = damp*speed;

Also, have you checked the new new Sample Assets? It includes a car and maybe they implemented some kind of suspension as well:

https://www.assetstore.unity3d.com/#/content/14474

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 SuperProgrammer · Jan 23, 2014 at 03:10 PM 0
Share

currently my formula act like a damper, if compression increases, add force into spring force if compression decreases, removes force from spring force i checked sample asset but it is using normal wheel collider.

For my formula problem starting when spring force near stable. Because: Lets say Sforce + Dforce = stableforce>>next frame>>Dforce = 0 so body drops down, compression increases>>it generate Dforce, now our Sforce + Dforce > stableforce >>compression decreases>>Sforce + Dforce < stableforce, This loop continue and this occurs vibration.

i think i shouldn't take compression from raycast. Because in this system, Wheel always in contact with ground. But in real life, sometimes its loseses contract for a short time. And maybe this can change vibration effect.

Anyway, can i find normal wheelcollider source?.

avatar image HappyMoo · Jan 23, 2014 at 03:21 PM 0
Share

Have you checked the wikipedia article about damping, especially the system behaviour part?

http://en.wikipedia.org/wiki/Damping

I just skimmed it for now, but wiwth those formulas, you may be able to find good constants for your spring and dampers. Also, keep in $$anonymous$$d that the values are always only valid for one type of car and it needs adjustment if you change car mass etc. You surely thought about that, but I mention it still, because you may not test your suspension under realistic conditions - like if you don't really put the full cars weight into it, they might act differently than on the car

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

19 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

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Wheel Graphic movement along WheelCollider Suspension 0 Answers

C# Custom Collision Script (solved) 1 Answer

How to put specific shapes/textures instead of generating colors (C#) 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