• 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 ronronmx · Jul 12, 2011 at 05:08 AM · collisionforce

Calculate Force of WheelCollider hitting the ground?

I know there are a few topics about calculating the colliding force between 2 objects, but my problem is a little different.

I'm trying to calculate the force of impact of my WheelCollider hitting the ground. The WheelCollider is on a motorcycle with a rigidbody, but the ground collider doesn't have any rigidbody or mass attached to it.

Right now I'm using the following code, which works for most situations:

collision.impactForceSum.y

which calculates the vertical collision forces, but doesn't seem to take into consideration whether I'm landing on flat ground or in a downhill slope, as the collision force is pretty much the same in both cases (coming down from the same height).

Any help much appreciated, as always :)

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
2
Best Answer

Answer by Edy · Aug 13, 2011 at 06:40 PM

The field force of the WheelHit struct is the value you are looking for:

 var Hit : WheelHit;
 if (WheelCol.GetGroundHit(Hit))
     {
     // Hit now contains all the data on the contact

     Debug.Log("Force: " + Hit.force);
     }
 else
     {
     // wheel is in the air - no force is generated.
     }    

The Hit.force value is correct even when the wheel hits the ground after being in the air. This value greatly depends on the suspension parameters (spring, damper and suspensionDistance). For instance, if suspensionDistance is very small then you'll be likely receiving high force values as the wheel impacts the ground (hard contact).

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 ronronmx · Aug 16, 2011 at 09:02 PM 1
Share

Edy, thanks for your answer, this is just what I needed and I'm sure it's gonna work better then using collision.inpactForceSum...

Stephane

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Disabling Kinematic on hit 2 Answers

How to add force to broken pieces upon impact? 0 Answers

Weird collision error when using waypoint script... 1 Answer

Movement around a huge object by avoiding obstacles 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