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
1
Question by pcdcreeper · Apr 26, 2021 at 05:38 PM · physicsspace

Calculating tangential velocity with radius and planet angular velocity,Obtaining tangential velocity of a particle given planet angular velocity and radius

I am currently trying to create a physics game. Newtonian gravity is in effect, I am rotating planets with addTorque, everything is set up based upon realistic physics models. I am trying to, given the distance between the planet and the player (i have this) and the angular velocity of the planet (I also have this), find the tangential velocity of the player, so they can stay grounded on the rotating planet.

I essentially need to apply some sort of acceleration, I just don't know where to get this acceleration.

What equation should I be using? Are there any useful functions for this purpose? I have looked into the docs, but I do not know where to start.

Thank you, and If code is needed, I will post it, though I do not believe it should be needed.

P.S. I am using a vector3 to define the rotational direction of the planet, addTorque then uses this to rotate it.

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
2
Best Answer

Answer by andrew-lukasik · Apr 26, 2021 at 09:14 PM


For a planet that's rotating at angular speed A [rad/s], a stationary point on it's surface will travel a distance in one second:

dist = A * r

Thus... giving you the linear speed value.

Note: r doesn't mean distance to planet center here but distance to rotation axis (so at the poles r is zero).


To convert this linear speed into a 3d vector you must know rotation direction vector. It can be calculated, for example, as:

direction_vector = Vector3.Cross( planet_rotation_axis.normalized , (point - planet_center).normalized )

tangential_velocity = direction_vector * dist

where planet_rotation_axis is angular momentum vector for left-handed coordinate system .

I make this point because UnityEngine.Vector3.Cross is "left-handed" where most physics books prefere "right-handed" convention. To convert between right-handed and left-handed vectors you just flip them by negating this vector -vec.

Comment
Add comment · Show 4 · 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 pcdcreeper · Apr 28, 2021 at 05:34 AM 0
Share

This is exactly what I needed! I was using the distance to the center of the planet, not the distance to rotational axis. Thank you!

avatar image andrew-lukasik pcdcreeper · Apr 28, 2021 at 07:35 AM 0
Share

Also you need to know that most in-game simulations do not calculate velocities for stationary objects (stationary in planet's reference frame). This is because it's nearly impossible to get rid of all kinds of numerical drifts, race conditions or just tiny randomness that accumulates and makes these objects jitter or even shake violently. If you need that objects come in and come out of planets reference frame, like rockets landing and taking off, it may be better to have 2 kinds of velocities - absolute and relative - and convert between those only on events of transition (rocket escaping a planet's gravity well will inherit it's velocity).

avatar image Bunny83 · Apr 28, 2021 at 08:35 AM 1
Share

I just like to add that mathematically the cross product does not have any "handiness". If you use it in a right handed system you get the right handed result, if you use it in a left handed system you get the left handed result. The cross product is always calculated the same. A simple way is to remember it is to use the rule of Sarrus. Since the difference between right handed and left handed is basically that one axis is flipped, when the input space is flipped, the output space is as well.


While it's possible to switch between right and left handed system (if done correctly) I would highly recommend you stay in one system. To invert the result of a cross product you can either invert the result as you said, or just swap the two vectors around.


ps: When you need a normalized vector It's slightly more efficient to first calculate the cross product on the non-normalized vectors and just normalize the result once.

avatar image andrew-lukasik Bunny83 · Apr 28, 2021 at 10:12 AM 0
Share

Oh dear, I have certainly tested this in the past but forgot about it and the totally wrong conclusion remained. As always, thank you @Bunny83 for clarifying! You're the best.

What I was really pointing toward there was that when translating physics equations from textbooks to Unity like, for example, this one:

text book equation for specific angular momentum


Will make you swap the axes with each other (Z and Y, most often). This single change will produce an inverted h vector. And, as you said, it's not because Unity's cross product is different, but because Unity's coordinate system differs from the one that given textbook uses.


textbook physics coordinate system

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

191 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

Related Questions

Collision and physics: asteroid 1 Answer

Artificial Gravity 2 Answers

Kill Rotation of object using forces 0 Answers

Physics: Auto-stopping a spaceship with reverse thrusters 1 Answer

circular orbit weird with physics 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