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 mohammadkhatri · Apr 11, 2013 at 04:00 PM · rotationrigidbodyspheretorquecenterofmass

Rigidbody rotation around CenterOfMass

Hello.

I have a sphere with rigidbody attached to it in a cylindrel tunnel.

Basically I want to rotate this sphere around center point of Tunnel space.

This sphere has Gravity also. So that rotation looks realistic.

How can I achieve this?

I have tried rigidbody.AddTorque But it rotates sphere around its center point.

CenTerOfMass of sphere is located at Blue point in image So that sphere can rotate at walls of tunnel.

The Image below gives clear Idea.

Thnx in advance.

alt text

scene.jpg (283.6 kB)
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 · Apr 11, 2013 at 04:16 PM 0
Share

An untested idea: Use Vector3.Cross() to calculate the cross product between the axis of the tunnel and a ray from the axis sphere to the axis. This will give you a side vector to the sphere you can use in a Rigidbody.AddForce().

avatar image mohammadkhatri · Apr 11, 2013 at 04:46 PM 0
Share

hey. Thnx for your Idea.But what actually needs to be done I can't figure out from your answer.what does this 'ray from the axis sphere to the axis' means?

avatar image mohammadkhatri · Apr 11, 2013 at 04:55 PM 0
Share

I've tried it But it gives some wiered behaviour to rigidbody. It throws the Ball out of the Tunnel.

avatar image robertbu · Apr 11, 2013 at 05:27 PM 0
Share

Not sure what is going on without seeing a video. A couple of thoughts. You want to normalize the vector you get from the cross product so that the force you apply is uniform. You can use Vector3.Normalize() or just use Vector3.normalzied in the calculation. Next use Debug.DrawRay() to draw the Vector3 you get back from the cross product starting at the position of the ball. If you've done your calculations correctly, you should see a vector co$$anonymous$$g out of the size of the ball at a tangent to the surface of the tunnel. If this is not the case and you cannot figure it out, post the code back you are using. Last, you want to reduce the bounciness of the ball and the tunnel by changing the properties of the physic material you are using for both.

avatar image electricsauce · Apr 12, 2013 at 03:29 AM 0
Share

Are you trying to get the ball to roll around the inside of a pipe?

Also, you might want to go ahead and activate windows.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Berkays · Apr 12, 2013 at 11:56 AM

Maybe MouseOrbit script inside unity can give you an idea

Comment
Add comment · 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

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

13 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

Related Questions

Constant Force doesn't work 0 Answers

Rigidbody rotation with PID controller and torque 0 Answers

How can I rotate around with a Rigidbody while respecting physics? 0 Answers

Rotating sphere with rigidbody attached 1 Answer

Object Reference Required to access non-static member 'UnityEngine.RigidBody.AddRelativeTorque' 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