# 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…

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…

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.

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!