Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 NutellaDaddy · May 05, 2014 at 11:30 PM · physicsgravityorbitplanetary

How could I simulate planetary gravity that has an orbit point?

How do you guys suppose I do this? I want to make it so that I can give an object gravity like a planets that has an orbiting point. If I make the gravity will it automatically have an orbiting point? I want to learn more about how to do this. Thanks for any help. If you want an idea of my hopeful result is something like how Kerbal handles planetary gravity.

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

1 Reply

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

Answer by Clet_ · May 05, 2014 at 11:51 PM

Obviously, you'll need to implement your own physics and get rid of all the PhysX built-in gravity.

The trick with planetary-like gravity, is that it's somewhat easy to simulate for perfectly spheric planet, but get relatively hard for non-spheric planets.

For a perfectly spheric planet, all you need to do is to apply the "down force" towards the gravity centre and any jump force in the opposite direction. Such direction can be calculated with

 Vector3 gravityDirection = (planet.gravityCenter.position - player.transform.position).normalized;

assuming that planet.gravityCenter is a Transform.

If you want realistic-ish physics, I'd suggest to look into Newton's Law of Universal Gravitation, which takes into account the mass of the 2 objects attracting each other and the distance from each other

Comment
Add comment · Show 2 · 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 NutellaDaddy · May 06, 2014 at 12:05 AM 0
Share

Would it be hard to make this effect the acceleration of a gameobject and how force acts against the pull or would it do that on it's own? Also would this allow implementation of an orbital system?

avatar image NutellaDaddy · May 06, 2014 at 12:48 AM 0
Share

I've been reading about Newton's Laws and such and I'm working on a script for it right now. Thanks for the help!

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

21 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

Related Questions

Faux Gravity Prolem? #2 2 Answers

problems with single body Newtonian physics emulation 0 Answers

How do i stop rigid bodies jumping? 1 Answer

How to make an axis always face an object? 2 Answers

Changing gravity affecting 'random movement' behaviour script - my NPCs go crazy, what should I do? 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