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 /
  • Help Room /
avatar image
0
Question by Smoopadoop · Oct 24, 2015 at 01:39 PM · rotationforcetorque

How do I add forward force to an object so that when it rotates, it still goes forward relative to the object, not the world? (picture inside in case I worded it badly)

Does this make sense? Is it even possible? Sorry if this has already been asked, I don't know what to search to find this

alt text

help-me.png (23.7 kB)
Comment
Add comment · Show 2
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 toromano · Oct 24, 2015 at 03:24 PM 0
Share

http://docs.unity3d.com/ScriptReference/Rigidbody.AddRelativeForce.html

avatar image Smoopadoop toromano · Oct 25, 2015 at 01:24 AM 0
Share

That doesn't quite work, sadly. If I rotate while moving, then the board keeps moving sideways, like in the picture. Then, if I add force again, it is in a see$$anonymous$$gly random direction! What do

1 Reply

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

Answer by Statement · Oct 25, 2015 at 01:42 AM

Okay, so you want to model a skateboard. Skateboards have wheels. Perhaps you should look into Wheel Collider, as this will most likely simplify a lot for you. This should most likely be your first attempt on making wheel physics.

If you want to do the physics yourself, you can. I am not a physics math expert but I can let you pick my brain for ideas and try stuff out. Below is my own approach on solving the problem.

So, I am not a skateboarder myself and I don't know how forces are distributed when it comes to turning. But I can give you an example of how I understand wheels to work on cars (and mind you, this may be incorrect but I am trying my best here). The wheels on cars turn and rotate (or spin). The driver doesn't "add a force to the center" or "rotate around the center" of the car when they want to accelerate or turn. The forces are applied at the wheels.

Imagine a car is driving forward and then turns. No acceleration is applied during this example.

As the wheels turn, their axle will no longer be in line with the cars momentum vector (pink). As a result, the wheels will experience resistance forces (red) opposite to the momentum vector and experience greater grip depending on the angle between the momentum and the axle. The wheel itself has angular momentum (around the axle, blue arrow shows wheel top direction) and is in contact with the surface.

Forces are applied to the rigidbody, at the wheels,

I made an example which model a car with wheels in 2D. Each wheel act on the rigidbody. Turning the wheels implicitly rotates the car due to the traction forces (I dont know if it's called traction usually, but that's what I call it - grip, whatever).

  • Click to play WebGL demo. (Many cars demo)

  • Example project

  • Wheel.cs

Comment
Add comment · Show 5 · 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 Statement · Oct 25, 2015 at 01:56 AM 0
Share

I'll get back to this answer tomorrow and try to elaborate on how you can get car-like or skateboard-like behavior if you haven't got an answer that solves your question.

In the end, the behavior is what matters, not the phrases you used to describe it. I got too hang up on it and didn't consider what it was going to be used for when I wrote the answer.

avatar image Smoopadoop Statement · Oct 25, 2015 at 07:31 AM 0
Share

What do you mean by traction control? Like, make one side of the board more friction-y than the other so that it turns?

avatar image Statement Smoopadoop · Oct 25, 2015 at 12:55 PM 0
Share

Yes, kinda. But ins$$anonymous$$d of just applying friction against the momentum vector, you scale it with the dot of the wheels angle. So if the wheel is at an angle to the momentum vector, it will start applying traction (or friction) to try and steer it toward the momentum vector. Play the example, drag the sliders, arrow keys drive car. Then look at the source code.

Show more comments
avatar image Statement · Oct 25, 2015 at 01:14 PM 0
Share

Note: You could just grab the math from ApplyTraction to customize your existing solution. In that case you can think of your entire skateboard being one wheel.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How To Rotate Player with Rotating object 0 Answers

Instant rotation bug when rotating clockwise 0 Answers

Access 2DCollision Torque/rotation force and set it to 0 0 Answers

Rotate 2D pivot so that gun points at target. 0 Answers

Torque applies to one wheel, but inconsistently to the other wheel 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