How to measure global rotation


#1

I’ve been experimenting with epicyclic gears, in particular the asymmetric ‘looney gears’ that has 4 different size cogs with teeth that are prime numbers. I wanted to measure the global rotation of various components, but got odd values.

I made a simple test scene with one object in a parent null - all at world center. When I rotated the parent in B and measured the global rotation of the child, I expected the child GR to be same as parent rotation, but I got some strange results -

XPresso global rot only gave a (repeating) value from -pi to +pi

using Python -
obj[c4d.ID_BASEOBJECT_GLOBAL_ROTATION,c4d.VECTOR_Z] gave same as XP above
Z vector from c4d.utils.MatrixToHPB(m) gave 0 to 2*pi (even with -ve rotation)

I’m guessing it’s me who doesn’t understand global rotation. Any ideas ?


#2

Ok, this is probably stupid of me to say, and not understanding the math or the exact function of epicyclic gears.

I’m assuming you are trying to measure the global rotation of the “larger” gear, that will drive the smaller gear which rotates AND revolves around the larger gear. So are you trying to find the rotation of the larger gear being driven by the parent null to use XPresso with a value or math node to drive the rotation of the smaller gear being driven by the larger gear?

I’m trying to wrap my head around this, seems like a fun challenge.

I’m also not sure if this will help at all, but I found this with a quick search. Hope it does though.


#3

You need to be aware that global rotation is the result of a calculation, not immediate data. Local rotation is what is stored in the object and then computed with the matrices of all parents to derive at the global rotation. This transformation can lead to all kinds of side effects, like the ones you observed, so you should use local rotation whenever possible.


#4

Thanks Srek - that makes sense.

@Remi I more or less understand epicyclic math - there’s an example in this zip file. The other scene in the zip ‘looney gears’ is based on a puzzle toy where the challenge is to guess how many times the red ‘13 cog’ must be turned to get all the other cogs lined up again. I wanted to measure the global rotations, but as Srek said, it’s not really possible.

https://www.dropbox.com/s/xk0a45glbmqg6pv/gears.zip?dl=1