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 /
This question was closed Dec 17, 2013 at 06:37 PM by robertbu for the following reason:

Other - Asker request

avatar image
0
Question by CookieKirby · Dec 17, 2013 at 01:02 AM · vector3gravityaccelerationrigidbodies

How can I accelerate a rigidbody towards another at X m/s?

I cant figure out how to accelerate one rigidbody (rigidbody A) towards another (rigidbody B) at a rate of X m/s WITHOUT rotating rigidbody A towards rigidbody B. X would exponentially decrease as the distance increases, like gravity, and completely stop after a configurable distance, perhaps using Physics.OverlapSphere. I also only want to have to add the script to rigidbody B. Any help is appreciated, I am new to unity.

Comment
Add comment · Show 6
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 robertbu · Dec 17, 2013 at 01:07 AM 0
Share

I also only want to have to add the script to rigidbody B

I don't know your setup or goals, but doing it this way makes your code pretty ugly.

X would exponentially decrease as the distance increases

Consider a linear rather than an exponential decrease. It may feel/look better to the user.

avatar image CookieKirby · Dec 17, 2013 at 01:15 AM 0
Share

@robertbu, the reason it has to be exponetial is because i am making a realistic space flight simulator, similar to $$anonymous$$SP and looks/feels are second to realism in my project. As for me only applying the script to rigidbody B, i dont want to have to add it to every other object

avatar image mescalin · Dec 17, 2013 at 01:23 AM 0
Share

in update:

transform.rigidbody.AddForce((locationA-locationB) * $$anonymous$$assOfThing)

and depends what you consider a meter

avatar image CookieKirby · Dec 17, 2013 at 02:58 AM 0
Share

by meter, i mean 1 unit in unity

avatar image robertbu · Dec 17, 2013 at 05:54 AM 0
Share

If you looking for realism then you'll have to have realistic scale and mass. Here is a link about planetary gravity:

http://answers.unity3d.com/questions/359759/how-to-program-gravity-for-planets.html

Show more comments

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

18 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

Related Questions

Applying force with respect to angle with the ground? 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

How to set gravity for model? 1 Answer

How do I get one object to point toward another using rigidbody physics? 2 Answers

Faux Gravity Prolem? #2 2 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