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 Multiplayer · Jan 05, 2013 at 04:53 PM · rotationphysicsjoints

How to reliably orbit a position with joints or any other way

I simply want a game object to orbit a fixed point on a plane. Imagine a standard model from school of the earth orbiting the sun.

What makes it complicated is that I also want my game object to still react to other objects, for example if it is hit from the front by a bouncy object it should change direction while still keeping its distance to the center point.

Before Unity, I build the exact same thing with Box2D (different Physics engine). I simply fixed a joint to the center point and the game object. Done.

In Unity, it does not seem to be that easy. The moment my game Object gets fast or is hit by another object, the joint will not stay in place. It will wiggle and the circular motion might even become more of a rectangle if movement is fast. I tried a hinge joint with the hinge on top of the center Point and also linking a central object to the circling one via fixed joints and a long object in between.

I have learned that the problem can be helped by a) lowering the minimum time step b) raising the iteration count

I tried both options and they wont do for me, since keeping the distance in that case is really central to my game and a) both options still won't fix the problem completely b) I am afraid that I will regain rectangular motion when fps drop, as the time step will then go up.

What I am now planning to do is to use Transform.RotateAround, thereby orbiting by hand. This means that i will have to handle any physics related Behavior myself, since Transform.RotateAround is not part of the physics engine, which means it does not cause any real movement.

That sucks.

So I would like to know: Is there any other way to orbit a position? Or maybe even a way to make a joint stay in place, therefore reliably keeping a distance between an object an a point in space?

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 robertbu · Jan 11, 2013 at 07:34 PM

Try:

  • Add a configurable joint component

  • Freeze all motion and angular motion settings except the axis you want to rotate around (Y in my test case).

  • Move the object to the "track" and then positions the anchor at the center.

  • Turn on projection mode for position and rotation

  • Set Projection Angle to 0.01

In my simple test, I had minimal wobble with a solver iteration rate at the default of 6.

Given that you have a predictable track, you could also move the object with Rigidbody.MovePosition() and you could limit the velocity so mute the effects of large impacts. Changing the mass also can help. I gave the ball a mass of 0.1f in my test.

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 Multiplayer · Jan 11, 2013 at 10:33 PM 0
Share

Thanks, but as you have stated, none of these $$anonymous$$ethods gets rid of the wobbling completely. It might be tolerable, but I guess I am just to paranoid to accept such a less than exact simulation.

Especially since it might hurt me in the long run, because the movement might become extremely fast and the radius extremely small, which will lead to bad behavior however small the wobbling is in normal cases.

Also, I can not (read : do not want to) change the mass, as it would affect the simulation in every other way as well.

Rigidbody.$$anonymous$$ovePosition is no option either. When you use it, the velocity of your body is zero as far as the physics engine is concerned. That means every other Object will act very strange when it hits you, as you are clearly visibly moving while the collision works as if you are standing still.

What I ended up doing for now is similar though: First I rotate where I want to go within the next fixedUpdate with transform.RotateAround. I remember that place and rotate back via transform.RotateAround as well. Then I set up my velocity so that I will reach that point at the end of the next fixedUpdate. That way I get to have a real velocity and it is exact enough that it probably takes thousands of orbits until I get to a place I do not want to go due to rounding errors.

If anybody knows a way to actually fix Objects together in a 100% reliable way I'd still be interested, but by now I doubt it :-)

avatar image Multiplayer · Feb 10, 2013 at 09:09 AM 0
Share

$$anonymous$$arked this as an answer, as the final answer seems to be "not possible".

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

Tumbling a cube 1 Answer

How can I make a wheel spin more freely using joints in Unity? 0 Answers

Configurable Joints pass through colliders 2 Answers

Freezing Rotation and Joints (Swing / Rope) Physics Issues 1 Answer

How not to make a RigidBody not go into ground when tilted foward? 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