Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 matthrubii · Mar 26, 2020 at 09:40 PM · unity 5physicscontrollerfrictiontorque

How to apply frictional Torque

Hi

So my goal is ultimately to simulate a PID controlled wheel for a ball balancing on top of it, for those who know something about control systems. Nevertheless for the beginning, I want to make a wheel controlled by a human, in this case me, steering the direction of rotation of the wheel with the left and right arrow keys.

So I imported the wheel from a CAD model as an .obj file and made the ball in Unity. I implemented the controls for the wheel like this:

alt text

I added a mesh collider to the wheel and a sphere collider to the ball. I can rotate the wheel, but it does not affect the behavior of the ball. I tried applying physics materials and added maximum friction. Even trying the same thing with two cylinders from Unity does not work.

So, how can I achieve the frictional torque from the wheel? alt text Side note: The custom wheel is not a rigid body because, it would delete the mesh collider and add a very primitive collider to it.

Thank you in advance!

ballonwheel.png (342.1 kB)
wheelcontroller.png (176.8 kB)
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Shrimpey · Mar 30, 2020 at 09:05 AM

Do mind that transform.Rotate does rotate the object, but does not affect physics engine itself. No torque is added this way to the rigidbody. You need to have rigidbody and then use rb.AddTorque to make the physics engine rotate the object.

Comment
Add comment · 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
0

Answer by matthrubii · Mar 30, 2020 at 10:05 AM

@Shrimpey Thank you for answering! Ok, I will keep this in mind. I tried to make a rigid body out of my CAD wheel model, and turned out that the mesh collider would turn to a primitive collider like a cylinder and "lose" the actual geometry for colliding with the ball. How can I apply Rigid Body and keep the complex collider as it is ? If this doesn't work would I have to make it with a normal cylinder geometry?

Comment
Add comment · Show 4 · 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 Shrimpey · Mar 30, 2020 at 11:40 AM 0
Share

I don't quite understand, when you have a gameobject, you can just add "$$anonymous$$esh Collider" component and choose your complex shape there. So your GO should have mesh filter, mesh renderer, Rigidbody and $$anonymous$$esh collider. On top of that, I think that for your purpose you should have simple, cylinder collider, complex mesh colliders can be buggy, especially as the only thing you need it for is cylinder like rotation.

avatar image matthrubii Shrimpey · Mar 30, 2020 at 07:29 PM 0
Share

Nice thank you! I managed to apply torque to the wheel and it really works with the friction and so on... Nevertheless I'm still wondering why my mesh collider disappears, as I add a rigid body to the wheel and the "colliding zone" is only in a form of a cylinder. So maybe I have to mention that the wheel is imported by CAD model and it kind of split up into a mesh, a prefab and a material in unity. As I add the wheel to the scene I have a children and a parent object. And I don't know exactly to which part I should apply all those things like mesh renderer etc... If this work I would try this because this looks more realistic than a normal cylinder form.

avatar image Shrimpey matthrubii · Mar 31, 2020 at 08:33 AM 0
Share

Oh, I have not worked with CAD models, you'll need to do your own research on that, but my guess is that the way you made it in CAD was with a few separate parts (meshes) and hence Unity is importing it that way. You should look into your CAD software and see if it is possible to merge all the parts and export as one mesh. You can also look at the imported object properties in Unity, maybe there will be some useful import options there for you to check.

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.

Follow this Question

Answers Answers and Comments

294 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Sailing Ship - How to apply torque without lateral friction killing all velocity? 1 Answer

Friction between two rigidbodies 0 Answers

Unity 5 - Sliding Rigidbodies with maximum friction 2 Answers

Delaying Physics Calculations (Friction) 1 Answer

Calculating Sphere vs. Plane Friction 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