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 LysolPionex · Mar 22, 2013 at 04:26 AM · rotatecuberotatearoundrolladdtorque

Apply torque/force to rotate an object around a fixed point

I have a cube I want to rotate from one face to the next, 90 degrees, moving the distance of one square with each rotate. I've successfully done this with transform.RotateAround(), but I want to use physics so the cube can fall etc.

I'm attempting to do this using rigidbody.AddTorque(), but it spins the whole cube, kinda in place, as if it were spinning when it hit the ground. What I want is for the edge to seem affixed to the ground when it rotates - if enough torque were applied it should bounce back and forth keeping that edge in the same place. Is there any way to do this?

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 Fattie · Mar 22, 2013 at 07:59 AM

The secret is you must think: how would you do this in real life

So, how would you do it ?

I'd probably try it like this at first. A -y force on the bottom near the left edge. A force (-1,-1,0) on the left near the top edge. And I'd try to make a "catch" or something to hold the lower right edge as you pushed it, marked in mustard color on the sketch.

(Eg, maybe just add a tiny block or bar or something down there on the floor - experiment with making it disappear after a second or a certain amount of twist or whatever for different results.)

alt text

I'd probably make the first mentioned force kick in for a short time and only then add the second mentioned force. Or it could be that only the first mentioned force is necessary, but you have to make it travel with the cube, always pushing at a tangent to that face as you go but perhaps never more than horizontal as the cube goes over the top.

Its very hard to make these things look "ah hah!" when using physics, I suggest begin by thinking what you would actually do with your hands. What if the cube was about 4m tall and you were trying to do it with a group of human friends? What if you had a horse and some rope? How would you go about it?

Also you must think carefully on the size and mass of the object (use meters / KG in Unity) and the two PhysicMaterials involved.


image.png (135.9 kB)
Comment
Add comment · Show 1 · 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 LysolPionex · Mar 25, 2013 at 01:14 AM 0
Share

So I did something like that in principle. I put a HingeJoint at the edge it flips over, freeze the axes not being rotated, torque it, and then remove the HingeJoint. It works for a few flips, and then the hinge ends up to low and the cube gets hung and doesn't quite rotate all the way. I'm going to change how I place my HingeJoint, by putting it between the two corners of the BoxCollider, so it is exactly where it need be.

I'll try to remember to post the basic code for this when I get it ironed out.

Thanks for the inspiration, everyone! :)

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

11 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

Related Questions

Making a ball roll and keeping the axis? 2 Answers

Rolling Cube with Rigidbody? 5 Answers

Rolling a ball in 2D, in direction of movement 1 Answer

How to rotate an object around its 3 axis and translate it on 2 world axis so it looks like its a dice rolling? 3 Answers

Why am I getting 2 different results with RotateAround? Trying to move cubes on surface of sphere. 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