rotations about local origin

Hi,

I made a really simple propeller plane model out of a few boxes. I made a simple assembly class so when a transformation is applied to the body, the wings and everything else move with the body in the same motion, it works fine.

I want to make the propeller spin independently of the body. I tried applying a rotation matrix to it but then it gets detached from the body and goes spinning off elsewhere.

How can I write a RotateAboutOwnOriginX() function so the propeller in this case just rotates about its own origin?

Thanks
DJ_AM_JuiceboxAsked:
Who is Participating?
 
ikeworkConnect With a Mentor Commented:
> The only easy way I can see is for each polygon, maintain a secondary list of vertices which keep track of its original
> starting position when first created, then every matrix applied just keeps accruing from those starting points -
> so every transform appears to start from when the model is at the world origin.

excectly that is done in most applications. at start of each frame the original points, which are never changed, are copied to another buffer and all the transformations in this frame are applied there .. and at the end of the frame those points are rendered .. that is much easier to handle ..
so in the case of your propeller, you can store it as a seperate object, all points are defined relativ to the *spinning point*, which is the local {0,0,0} for that object. do the spinning for it in this frame and translate it to the parent object's point to attach the propeller .. if you have objects like that composed of little objects you can think about a tree representing the whole object. at each node of the tree, i.e. the propeller is a matrix defined to move it to the parents-position and the vertices, which define the object independently in its local-coord-system

ike
0
 
ozoCommented:
That's equivalent to translating (OwnOrigin) to (0,0,0) then rotating around (0,0,0) then translating (0,0,0) to (OwnOrigin)
0
 
DJ_AM_JuiceboxAuthor Commented:
Ozo, how do you translate back to the world origin 0,0,0 though - I mean, the vertex list of my polygon has been modified after many transforms already - how would I know what matrix to apply to get it back to the origin?

The only easy way I can see is for each polygon, maintain a secondary list of vertices which keep track of its original starting position when first created, then every matrix applied just keeps accruing from those starting points - so every transform appears to start from when the model is at the world origin.

Is that right?
0
 
ozoCommented:
Do you have a vertex on the rotation axis of the propeller? Just use that point as the offset to (0,0,0)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.