• 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 FriedrichWessel · Jun 15, 2011 at 05:53 PM · physicsmeshcollider

Strange collsions behaviour with MeshCollider

Hello everybody

I am working on some tests for a racing game with hovering cars. I have some strange behaviour regarding collisions if I use a simple plane with a mesh collider instead of a terrain and a terrain collider. If I drive my car straight without turning left or right the car begins to change direction, jump and roll over (just as if it hits small objects on ground). If I use an terrain everything works like expected.

Here are some details: The car is a cube with a mesh collider and a rigidbody attached Standard plane with mesh collider as ground

Physics material values for both:
Static Friction: 0.01
Dynamic Friction: 0.4

Car's rigidbody values:
Mass: 1500
Drag: 0.001
Angular Drag: 0.04
Use Gravity: On

In the attached script I do the following inside the FixedUpdate() (stripped down to the important parts). Basically, this is a crude attempt to simulate the behaviour of a simple engine. All you guys probably need to know is that I use AddRelativeForce().

     float friction = mBody.mFriction;
     float enginePS = mBody.mEngine.mEnginePS;
     float maxSpeed = mBody.mEngine.mMaxSpeed;
     currentSpeed = rigidbody.velocity.magnitude;


     float force = ( enginePS * valueZ - friction * currentSpeed ) ;
     Vector3 direction = new Vector3(force,0,0);
     Vector3 rotation = new Vector3(0,valueY*currentSpeed,0);
     
     gameObject.transform.Rotate(rotation);
     gameObject.rigidbody.velocity = Quaternion.AngleAxis(valueY*currentSpeed, Vector3.up) * gameObject.rigidbody.velocity;
     gameObject.rigidbody.AddRelativeForce(direction);

Values from Debug out:
Friction is 300
Engine Ps: is 250 000
Max Speed: 500
Force is between: -50 and 250 000

Comment
Add comment · Show 4
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 QuantumRyan · Jun 15, 2011 at 06:38 PM 0
Share

Do you mean it works if you use a flat terrain ins$$anonymous$$d of a flat plane?

avatar image FriedrichWessel · Jun 15, 2011 at 07:31 PM 0
Share

Yes. On a Terrain plane or not doesn't matter - it works. On a flat plane with a mesh Collider I get the strange behavoiur.

avatar image Chris D · Jun 15, 2011 at 08:36 PM 0
Share

So both your terrain and your car have mesh colliders on them? I thought mesh colliders couldn't be used against other mesh colliders (bottom of page):

http://unity3d.com/support/documentation/Components/class-$$anonymous$$eshCollider.html

avatar image QuantumRyan · Jun 15, 2011 at 10:05 PM 0
Share

I played with a new project a bit and there is defiantly something different with the way physics works between with a mesh (or box) collider and the terrain collider.

$$anonymous$$aybe you can tweak your phyic materials to get the behavior you want.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Performance characteristics of creating MeshColliders at runtime? 0 Answers

Physics Raycast gives hit in wrong place 0 Answers

Mesh Collider, Unexpected Collision Behaviour 0 Answers

Bake mesh collider on separate thread? 0 Answers

Question on Collider Resource Consumption 0 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