COFFEE equivalent of...



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 18/04/2010 at 15:43, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   11 
    Platform:      Mac OSX  ; 
    Language(s) :   C.O.F.F.E.E  ;  C++  ;

    ---------
    This C++ code allows me to rotate an object explicitly around it's axis bands (strict local rotations)... it also moves the object along it's axis handles, but that's not part of the problem... it's just the rotations.  Here's the code:

      
              matRot=HPBToMatrix(vecRot);  //vecRot is the rotation transformation vector. Basically, the input  
              trans = trans ^ matRig;  //trans is the pos transformation vector, transformed into object's space  
              matRig.off = op->GetPos() +trans;     //trans added to the object... propulsion, basically.     
              matRig=matRig*matRot;  //transform rotation matrix into object's space  
              op->SetMg(matRig);  
      
    

    Is this possible in COFFEE?  The functions that are giving me the trouble are HPBToMatrix() and the multiplying of the 2 matrices in line 4.  How do I do those things in COFFEE?  I'll be honest, matrices have always confused me a bit;)

    In the past, I've used a child object to generate the rotation matrix (via xpresso), and the MoveObject() function posted by Mikael Sterner from years ago here.  But I'd like to be able to accomplish the rotations without the need for a child object.

    thanks,
    kvb



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/04/2010 at 03:35, xxxxxxxx wrote:

    HPBToMatrix() is SetRotHPB()
    Matrix multiplication is done with GetMulM(), MulM_R() and MulM_L()

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/04/2010 at 13:09, xxxxxxxx wrote:

    Thanks Matthias... again;)

    Here's the code that finally worked (turned out I was getting the matrices backwards when trying those functions before) :

      
    var objm = obj->GetMg();  
    var matRot = new(Matrix);  
    var vecRot = vector(0.01,0,0); //test values  
      
    matRot->SetRotHPB(vecRot);  
    matRot->MulM_L(objm);  
    obj->SetMg(matRot);  
    

    -kvb


Log in to reply