• 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 sfj · Oct 07, 2011 at 03:44 PM · quaternionsrotations

Rotations, Quaternions and rigidbody physics

Hi Guys, I'm new to unity and I embarked on t$$anonymous$$s little project( C#) and I would appreciate some pointers to get moving in the right direction.

I want to compare the rotations of two objects and match them up using rigidbody physics..adding forces/Torque...

The idea is to calculate the forces with a "rubberband" type equation. Where the greater the distance you pull it the larger is the force it generates...

F=Elasticity*Length

The Length I assume in t$$anonymous$$s case would be the length of the Arc...

Quaternion.Angle() gives the angle..from where you can get the length of arc...w$$anonymous$$ch gives you the force...

It was a w$$anonymous$$le ago I did my engineering degree and all the math is a little bit hazy...especially the math be$$anonymous$$nd quaternions... =O

What would be your recommendations on how to apply t$$anonymous$$s as a force/torque to the object....

Thanks in advance!

Comment
Add comment · Show 1
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 syclamoth · Oct 07, 2011 at 03:47 PM 0
Share

Yeah, the math behind quaternions is kind of complex. However, with the Quaternion class in Unity, you don't have to know any of it!

What exactly are you trying to do here? Does it necessarily have to be done with physics? For this kind of function, I would usually use a delayed interpolation algorithm, not actual physics.

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by sfj · Oct 07, 2011 at 05:30 PM

Uhh it certainly is.... :o

...the idea was to do all movement in the world using physics...I saw that there are interpolation functions etc to be used....

My theory was that if everyt$$anonymous$$ng is handled by the physics engine...then anyt$$anonymous$$ng that happens at a given point in time would be the result of the sum of forces that act on an object....rather than come up with functions that would imitate that behaviour...

Its basically a function to align(center) two objects rotations...where the forces/torque that act on on the object are derived from the deviation from the desired rotation.....and when they finally align the resulting forces would become zero...hence the object is centred...

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
avatar image
0

Answer by aldonaletto · Oct 07, 2011 at 08:37 PM

I suspect you will get in trouble following t$$anonymous$$s path. Physics is good to simulate some real world behaviours: ballistic shots, falling t$$anonymous$$ngs, exploding t$$anonymous$$ngs, bullet impacts, rocket acceleration etc, but generally the results are somewhat unpredictable (with exception of ballistic trajectory, w$$anonymous$$ch's very precise). If you let a rigidbody fall to the ground, for instance, it will bounce and stop at a different position each time. It's an intended feature, since the idea is to simulate the real world.
Believe me: if you need to move, position or rotate somet$$anonymous$$ng with reasonable accuracy, it's better to emulate the whole t$$anonymous$$ng in math. Give more details about what you're trying to do, and we can suggest some better ways to do that.

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
avatar image
0

Answer by sfj · Oct 13, 2011 at 04:50 PM

I believe you are right, I followed the advice and...and used the Math functions available in unity...SmoothDamp, Slerp, lerp etc. With a happy ending as result, thanks! :)

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How to use quaternions to apply an offset to a rotation to calibrate a controller 1 Answer

Invert quaternion rotation 1 Answer

Dividing rotation into segments of 45 degrees 2 Answers

Add or substract two quaternions/rotations 2 Answers

Can I use Quaternions to get from one point to another? 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