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 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 this 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 this case would be the length of the Arc...

Quaternion.Angle() gives the angle..from where you can get the length of arc...which gives you the force...

It was a while ago I did my engineering degree and all the math is a little bit hazy...especially the math behind quaternions... =O

What would be your recommendations on how to apply this 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 everything is handled by the physics engine...then anything 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 this path. Physics is good to simulate some real world behaviours: ballistic shots, falling things, exploding things, bullet impacts, rocket acceleration etc, but generally the results are somewhat unpredictable (with exception of ballistic trajectory, which'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 something with reasonable accuracy, it's better to emulate the whole thing 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.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Quaternions rotating left and right, not forward and back 1 Answer

4 rotations WTF 1 Answer

Relative Rotations and Position calculation 2 Answers

My interpretation of Random.rotation and Random.rotationUniform. Right or wrong ? 0 Answers

How to use quaternions to apply an offset to a rotation to calibrate a controller 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