THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/12/2009 at 11:01, xxxxxxxx wrote:
Cinema 4D Version: 11
Platform: Windows ; Mac OSX ;
Language(s) : C++ ;
op->SetPos(op->GetPos()+ (trans ^ op->GetMl()));
To propel an object along one of its axis (where trans is a vector that represents a rate of movement along a particular axis per frame).
Works a treat:)
I thought I could do something similar with rotations by using:
op->SetRot(op->GetRot()+ (trans ^ op->GetMl()));
Apparently it's a lot more complicated than that, because I don't get the desired behavior.
Think of a plane in flight... that's the type of rotation I'm looking for. The object I'm trying to drive isn't part of a hierarchy and I'd rather not rely on hierarchy tricks to accomplish this. Any insight into the wonderful world of rotations would be most helpful:)
On 14/12/2009 at 11:49, xxxxxxxx wrote:
Why are you applying rate of movement to a rotation? You would want rate of rotation which doesn't involve translation at all but angular momentum. Now, if you are trying to induce a rotation from the direction vector that trans represents from one position to the next, you'll need to convert it into a delta rotation vector.
On 14/12/2009 at 12:11, xxxxxxxx wrote:
Trans was meant to be a different variable in the second line of code. I just kept it the same in this post for the sake of the reader, to keep the 2 code lines similar to show my train of thought more clearly. In my code, the second trans variable is actually called victor (an Airplane joke... what a great movie), temporarily of course. In hindsight, maybe I should have just copied them both exactly from my code:D
So, in code line 2, trans equals a rate of rotation about a particular local axis (it seems no matter what I do it's always calculating the rotations based on the world coordinates). No matter how the object is oriented in world space, I want this data to always rotate the object explicitly around it's local axis.
sorry for the confusion,
On 14/12/2009 at 16:26, xxxxxxxx wrote:
Ok, a bit more info. I had sort of solved this problem in the past using xpresso. I input the rotation change per frame (for each axis) into the respective local rotation input ports of a child object of the object to be driven. Then I output that child's global matrix into the local matrix of the parent (driven) object.
So, it looks like I need to find a way to create a matrix that mimics a child of my object (like a ghost) that I can alter with my input data then pump its global matrix into my objects local matrix.