calculate rotation values



  • On 15/12/2014 at 01:44, xxxxxxxx wrote:

    Hi Robert,

    while I empathize your anger about changes in the SDK, I need to ask for your understanding.

    The C4D developers don't change the API for fun. Quite the contrary is true, they do as much as they can to keep it as compatible as possible. Yet it is a thin line, as on the other hand external developers complain about inconsistencies in the API and claim further development. And finally internal development may cause the need for changes in the API as well and I'm pretty sure, we all want Cinema 4D to develop further.

    Believe me, none of the changes is taken lightly, instead quite long and lively internal discussions forego such changes.

    All I can do is to beg your pardon for any inconveniences caused.



  • On 15/12/2014 at 06:46, xxxxxxxx wrote:

    Hi Robert,

    Thanks for you reply

    i try it with 
    masterMtx = ~masterMtx;

    but the result is not invers

    Thanks



  • On 15/12/2014 at 07:09, xxxxxxxx wrote:

    It`s maybe a wrong understanding - I Like to mirror the slave object to master - same position but flipped.



  • On 15/12/2014 at 07:29, xxxxxxxx wrote:

    In the code I posted. The slave should rotate with the master.
    But if you change this variable: rotDir = true;
    Then the slave should rotate in the opposite direction of the master (mirrored).

    FYI:
    Just in case you're wondering. The reason I did not use -= and SetAbsRot() in my code is because that will make the object rotate every time the code is executed. And this will cause the object to keep spinning repeatedly every time the code is executed. Like a propeller.

    -ScottA



  • On 15/12/2014 at 07:35, xxxxxxxx wrote:

    hey ScottA,

    thanks for you help

    i use this code and the object is not mirrored -

    Matrix masterMtx = targetMagnet->GetMg();
                    Matrix slaveMtx = sourceMagnet->GetMg();
                    
                    //Get the three axis vectors for the two objects
                    Vector m1 = masterMtx.v1;
                    Vector m2 = masterMtx.v2;
                    Vector m3 = masterMtx.v3;
                    Vector s1 = slaveMtx.v1;
                    Vector s2 = slaveMtx.v2;
                    Vector s3 = slaveMtx.v3;
                    
                    //A switch the user can use to make the object rotate either in the same direction, or the opposite direction of the master object
                    
                    //If any of the axis vectors don't match up..Then the child(slave) is rotated differently than the parent(master)
                    if(m1 != s1 || m2 != s2 || m3 != s3)
                    {
                        GePrint(String::VectorToString(Vector(masterMtx.v1))+" "+String::VectorToString(Vector(masterMtx.v2))+" "+String::VectorToString(Vector(masterMtx.v3)));
                        masterMtx = ~masterMtx; //Invert the masterMtx so we rotate the target in reverse
                        GePrint(String::VectorToString(Vector(masterMtx.v1))+" "+String::VectorToString(Vector(masterMtx.v2))+" "+String::VectorToString(Vector(masterMtx.v3)));
                        slaveMtx.v1 = Vector(masterMtx.v1);
                        slaveMtx.v2 = Vector(masterMtx.v2);   //Set the slave axis to the same as the parent's axis vectors
                        slaveMtx.v3 = Vector(masterMtx.v3);
    

    the result of the prints are 
    (0;1;0) (1;0;0) (0;0;-1)
    (0;1;0) (1;0;0) (0;0;-1)



  • On 15/12/2014 at 08:41, xxxxxxxx wrote:

    It works fine in R13.
    They must have made some very drastic matrix changes in the R16 SDK.

    I will try to figure out the R16 version when I get chance.

    -ScottA



  • On 15/12/2014 at 08:47, xxxxxxxx wrote:

    beside from the mirror of the Slave - I stuck on the transform from a parent object.  I like to move the parent object - that the child(slave) match the master.

                        BaseObject *mother = sourceMagnet->GetUp();
                        if (mother){
                            GePrint(mother->GetName());
                            Vector DifabsPos = sourceMagnet->GetAbsPos();
                            slaveMtx = slaveMtx + MatrixMove(DifabsPos);
                            mother->SetMg(slaveMtx);
                            mother->Message(MSG_UPDATE);
                            EventAdd();
    

    Many Thanks



  • On 15/12/2014 at 09:34, xxxxxxxx wrote:

    I tried the code I posted in R16. And it works using ~ to invert the matrix.
    I'm not sure why it's not working for you?

    -ScottA



  • On 15/12/2014 at 09:38, xxxxxxxx wrote:

    For unterständig - i should see the invert by printing the vectors ?



  • On 11/03/2015 at 12:11, xxxxxxxx wrote:

    I'm wondering if this is solved?


Log in to reply