Advertisement

Rotation of an object

Started by January 04, 2002 03:24 PM
2 comments, last by Linenoise 23 years, 1 month ago
Hey guys.. I''ve been spending the past couple of days playing around with writing a 3d engine, and I''m getting a handle on it except for one thing - how exactly do you do rotation of an object? I don''t mean the matrices involved, but rather, how do you represent the rotational forces acting on an object? I''ve dug all over and can''t really find a clear answer to the problem, although I think I''m close to understanding it. I understand the linear version of it. An object has a Velocity vector and a Force vector that is the sum of all the forces acting on it. Do Velocity += (Force / Mass * Time), and you''ve got an updated velocity vector. But, how do you handle rotation? I''ve seen plenty of examples where you store yaw, pitch, and roll as seperate values, and calculate the matrix from there. But how do you handle things like friction? In the linear case, you can slow an object down by applying a force in the opposite direction of velocity. I''m guessing that it''s possible to represent rotational forces as a vector too, but there''s where I''m blocked.. I can''t quite see how to break the vector down into the actual rotation angles needed. Any help is greatly appreciated!
Rotation is force applied on a point of an object, that is "fixed" at another point

You can see the rotational force as going "up", and the friction pulling "down", the resulting force is the one that you actually use to calculate the momentum, and then you factor in time and jmp to your next frame... Err... At least thats how I learned it

-Maarten Leeuwrik
"Some people when faced with the end of a journey simply decide to begin anew I guess."
Advertisement
I guess that''s the part I''m not getting. If you have a vector representing the rotational velocity, how do you actually perform the rotation? I can''t quite grasp how to apply the vector to the model.

Here''s what I''m thinking so far..

Given a rotational velocity vector V, if I take V and dot it with (1, 0, 0), I get the rotational velocity in the X direction, which would be a rotation about the Z axis. But how do I get the amount/angle to actually rotate on the Z axis?

I found a demo program that, if I''m reading it right, takes the velocity vector and puts it in a matrix:

| 0 V.z 0 |
| -V.z 0 V.x |
| V.y -V.x 0 |

Then multiplies that matrix by the current rotation matrix to get the new one.. but I have no idea why (or if) that would work!

I''m guessing you already understand the physics of rotation in 2d and just need help in 3d. Once you''ve read a physics book that talks about rotation in 3d you''ll know what to do.

This topic is closed to new replies.

Advertisement