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 Laischen · Jul 05, 2014 at 10:29 PM · physicsrotate

My mind is going to quit my body. C#

By now I figured out the fact that I must be extremely stupid.

Imagine this: A number of masses. (blop blop blop) - kind of the sound the masses make when they're imagined. These masses are instantiated and scattered. That is, they just also happen to have random positions. And rotation!!!! That means that I can never know how they will instantiate. What I want to do: Imagine mass 1. Considering Gravitation , I have the amount of force calculated, and thus Omega (Radians per second). I consider gravitation from all masses, that is, mass 1 is affected by 2,3,4,5 etc, and vise versa for ALL THE REST. (After like 6 masses the game is already CPU heavy, because the complexity rises like a boss for every mass) Now , If I want, for simplicity, just imagine two masses. Random Rotation and position. I want to use RotateAround, to Rotate Mass 1 around Mass 2, and vice versa, depending on their also random masses , thus different exertions of force. Now, the thing is, I can't tell how the rotation will be. So it gets harder to use RotateAround. I can't use Slerp for gravitation, it looks really FALSE. Also, I can't define from and to, as that is always on the GO. How can I mathematically define a general axis for rotation?! I don't want to go the easy way and just give them all equal rotation, or make them all lie on a common plane. I want it to be realistic, and I am ready to take every measure, BUT I can't simply comprehend it! Like if the masses have a rotation of Mass1.transform.rotation , and Mass2.transform.rotation etc, how can I somehow manipulate that, to give a realistic axis of rotation for gravity? HELP, it is a matter of stupidity or death! HELP!

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

Answer by MakeCodeNow · Jul 07, 2014 at 12:08 AM

Check out Quaternion.AngleAxis.

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 Laischen · Jul 08, 2014 at 03:08 PM 0
Share

I think it might be it

avatar image Laischen · Jul 08, 2014 at 04:48 PM 0
Share

I tried it, and even though it seems to be the right function, I get no rotation at all. Here is a snippet of code of where I use AngleAxis:

 else if(z!=d&z!=0&d!=x&z!=x-1){ //calculates gravitation for all planets which are after planet z, and z cannot be the last planet or 0, of course.... :D
                 seperation[d-1]= System.$$anonymous$$ath.Abs(Vector3.Distance(planets2[z].transform.position,planets2[d].transform.position));
                 omega[d-1] = (float)System.$$anonymous$$ath.Sqrt((planets2[d].rigidbody.mass*G)/(seperation[d-1]*seperation[d-1]*seperation[d-1])); //root G$$anonymous$$/R^3
                 radtodeg=(omega[d-1]*180f)/convert;
                 Delta.rotation = planets2[z].transform.rotation;
                 Delta.position = planets2[d].transform.position;
                 planets2[z].transform.rotation = Quaternion.AngleAxis(radtodeg,Vector3.up);
                 Debug.Log (z);
             }

I debugged z to make sure the loops ran fine, and they did. Basically planets2[z] is the planet that I will rotate around planets2[d] They are simply planets put in an array. But for some reason none of them move. Delta is a Transform, which is given the rotation of planets2[z] (the one to rotate around) and the position of planets2[d] (the one which pulls gravitationally z around)

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

No APEX, what's the next best thing? 1 Answer

Exporting from Blender to Unity Help! 1 Answer

Tutorial went wrong, what to do? (physics) 2 Answers

Texture help 0 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