Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Rotation XYZ

    SDK Help
    0
    4
    258
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

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

      On 21/07/2004 at 03:45, xxxxxxxx wrote:

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

      ---------
      Bonjour

      I want to drive the rotation of an object (a bone) by the rotation of an other object (a bone) but I want to controle the rotation on X Y and Z independently.
      I have write this :
      main(doc,op)

      {     
                var a = 1.00;
                var b = 1.00;
                var c = 1.00;
           
           var tg = doc->FindObject("Os bras G"); if(!tg) return;

      var mo = op->GetMg(); //position globale de l'os tagué
           var mt = tg->GetMg(); //position globale de l'os pilote

      var Roto = mt->GetHPB(); //rotation globale de l'os pilote

      var xo     = RotX( ); // compiler : variable or function expected
                       var yo     = RotY( );
                       var zo     = RotZ( );

      var pos = mo->GetV0();
           var scale = vector(vlen(mo->GetV1()),
                                   vlen(mo->GetV2()),
                                   vlen(mo->GetV3()));

      mo->SetRotX(xo * a);
           mo->SetRotY(yo * b);
           mo->SetRotZ(zo * c);

      mo->SetV0(pos);
           mo->SetV1(vnorm(mo->GetV1()) * scale.x);     
           mo->SetV2(vnorm(mo->GetV2()) * scale.y);     
           mo->SetV3(vnorm(mo->GetV3()) * scale.z);

      op->SetMg(mo);
           
           return;
      }

      When I compile, on the line
                var xo     = RotX( );
      it display : variable or function expected. I don't understand what I have to do.

      Bests regards
      ( Sorry for my english, I am french)

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

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

        On 21/07/2004 at 05:10, xxxxxxxx wrote:

        I make mistake in my post. The right expression is :
        main(doc,op)

        {     
                  var a = 1.00;
                  var b = 1.00;
                  var c = 1.00;
             
             var tg = doc->FindObject("Os bras G"); if(!tg) return;

        var mo = op->GetMg(); //position globale de l'os tagué
             var mt = tg->GetMg(); //position globale de l'os pilote

        var Roto = mt->GetHPB(); //rotation globale de l'os pilote

        var xo     = RotoX( );   // compiler : varaible or function expected
                      var yo     = RotoY( );
                      var zo     = RotoZ( );

        var pos = mo->GetV0();
             var scale = vector(vlen(mo->GetV1()),
                                     vlen(mo->GetV2()),
                                     vlen(mo->GetV3()));

        mo->SetRotX(xo * a);
             mo->SetRotY(yo * b);
             mo->SetRotZ(zo * c);

        mo->SetV0(pos);
             mo->SetV1(vnorm(mo->GetV1()) * scale.x);     
             mo->SetV2(vnorm(mo->GetV2()) * scale.y);     
             mo->SetV3(vnorm(mo->GetV3()) * scale.z);

        op->SetMg(mo);
             
             return;
        }

        And my problem is on these lines :
              var xo     = RotoX( );
                      var yo     = RotoY( );
                      var zo     = RotoZ( );

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

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

          On 21/07/2004 at 18:21, xxxxxxxx wrote:

          Try this...
                           var xo     = Roto.x;
                           var yo     = Roto.y;
                           var zo     = Roto.z;

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

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

            On 22/07/2004 at 00:48, xxxxxxxx wrote:

            Thank you for your response.

            I try that before. No error of compilation and no error when I command "executate". But when I rotate the pilot bone around X axis the other bone turns around Z axis, when I rotate around Y axis the second bone turns only Z axis. In any way the second bone turns only around Z axis.

            Bests regards
            Damator

            1 Reply Last reply Reply Quote 0
            • First post
              Last post