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
1
Question by masterjaso · Jul 11, 2011 at 07:34 AM · rotationtiltbike

Motorcycle/Bike Physics Trouble

Greetings Unity Community.

I am currently working on a small project to create a MotoCross style dirt bike simulator/game. So far I have gotten an object hierarchy like such:

Bike Body Wheels Front Rear Wheel Collider FrontCol RearCol

I am actually rather happy that I have also been able to use a simple script to produce forward velocity using RearCol.motorTorque * Input.GetAxis("Vertical"). Add a bit of drag and I have a basic motorcycle that can accelerate forward and slow to an eventual stop when I release the throttle.

Now comes the part I haven't found an answer for. TURNING. I have experimented with the following items and got the following results:

Tried using the FrontCol.steerAngle * Input.GetAxis("Horizontal"). This was nice but the bike flips over after just a small amount of turn. Tried using rigidbody.MoveRotation around the Z axis (forward) and get the same result.

So from my research I have gathered the following inferences:

  1. Once the body tilts, it will continue to tilt until it falls unless countered by some force.

  2. The real world force that causes a bike to stay upright is angular momentum.

So here is my questions:

Is there such a thing as angular momentum in Unity that I am overlooking? If so, where do I access it? If there is not angular momentum, how would I simulate this correctly in my script to always 'pull' the bike back to the straigh upright position over time when the left and right buttons are released?

Thank you greatly in advance for any insight you may provide in this matter.

Comment
Add comment · Show 1
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 goutham · Apr 14, 2012 at 06:25 PM 0
Share

Experienced the same problem.... any replys for this prob???

5 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by lvlegab1te · Jul 04, 2012 at 08:53 AM

Im no expert and im not sure of the exact code you would use but i would

set normal position then

whenever left or right key is not pressed return to normal position over time

good luck

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 PAHeartBeat · Aug 08, 2012 at 11:58 AM

I am facing little different issue with bike racing game... my bike flips after a level of speed but tuning of rotating bike is fine.... you can check this link http://forum.unity3d.com/threads/146724-Motorcycle-Physic-Move-bikes-up-from-back-side

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 littlemuggo · Jul 22, 2013 at 05:29 PM

If you need a counter balance to your bike, you can AddTorque to the Rigidbody based upon angular velocity - this will allow you to push the bike back to a stable position you deem "stable".

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 LuizNegrini · Nov 13, 2013 at 04:22 PM 0
Share

what is the correct settings in the torque?

avatar image
0

Answer by ROLLERROCK · Apr 15, 2014 at 03:47 PM

maybe u could make two front wheels just a little far apart so just to stablieze it and u could also define a center of mass in the -y direction if it still flips u can use a downforce Hope I Helped!!!! :D

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 Maurice_B · Oct 05, 2014 at 10:17 PM

lower the center of mass helps

Rigidbody.centerofmass.y = lower than before

you could use a transform for the center of mass.

 var com : Transform;
 function Start(){
 RigidBody.Centerofmass = com.transform.position
 }


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

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

rotating/tilting the bike through accelerometer in unity. 1 Answer

Rotation without tilt around a globe. 1 Answer

Bike wheel rotation on x-axis and steering on y-axis 1 Answer

Slight Problem in the Camera Rotation Script 0 Answers

Gun tilting in the direction you look towards 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