• 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 friedbagel · Sep 18, 2018 at 11:00 AM · physicsspace

Adding a centripetal force to stop spaceship slipping at corners

I'm trying to make an arcade-y space sim type game. There are 6 degrees of freedom (throttle, strafe, elevation, pitch, roll, yaw) and I currently have the drag of the rigidbody set so that when decelerating in any direction the ship slows down in a nice gradual way. However I would like the ship to 'stick' to the corners while turning instead of slipping sideways.

One way of solving this (which I have tried) is to set the drag value very high but this means the ship slows down very quickly. I tried to solve this by making the actual throttle value slow down slower than the input throttle value but this quickly got complicated when dealing with the 3 directions of linear movement.

Now I would like to try and keep the ship traveling forwards by adding a centripetal force pointing inwards that will always counteract the side-slipping. I know realistic space sims like Elite Dangerous implement this system.

However, I'm not sure of an elegant way to apply such a force. What I'm trying to do right now is something like: void FixedUpdate () { // add forces from input script rb.AddRelativeForce (appliedLinearForce * forceMultiplier, ForceMode.Force); rb.AddRelativeTorque (appliedAngularForce * forceMultiplier, ForceMode.Force); // ADD CENTRIPETAL FORCE // find delta rotation and combine with forward velocity to find centrifugal Vector3 angleDifference = -rb.transform.InverseTransformDirection (lastDirection); float centripetalMagnitude = lastSpeed * Mathf.Sin ( angleDifference.z* (Mathf.PI/180)); Vector3 centripetalDirection = new Vector3(angleDifference.x,angleDifference.y,0); centripetalDirection.Normalize (); Vector3 centripetalForce = centripetalDirection * centripetalMagnitude * SOME_VALUE; rb.AddRelativeForce (centripetalForce, ForceMode.Force); lastDirection = transform.forward; lastSpeed = transform.InverseTransformDirection(rb.velocity).z; } I think this is sort of doing what I want but I am SURE this is not the best way of doing it, and also the centripetal force must be multiplied by some value (probably dependent on the mass) so it exactly cancels out the centrifugal force.

Any help would be greatly appreciated!

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

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

217 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

Related Questions

Applying torque to smoothly stop at a desired rotation - factoring Mass and a Max torque 1 Answer

Moving and Rotating a Player Smoothly on a Rotating Planet 0 Answers

I need to create artificial gravity ( like a fake fake centrifugal effect) 2 Answers

Can you point me in the direction of how to get space physics like the one in this video? 1 Answer

Why doesn't my asteroid field perfectly move with me? 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