Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    axis rotation

    SDK Help
    0
    5
    441
    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

      On 05/02/2013 at 11:59, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   r13 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hi,

      how can i apply a rotation like i do in the editor when enabling axis modification?
      i thought it could be SetModelingAxis, but what do i need to apply when i want a rotation of (0/0/-90)..

      thanks in advance,
      ello

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

        On 05/02/2013 at 12:56, xxxxxxxx wrote:

        If it should work like rotating in the Axis mode, you have to do it in two steps:
        - Rotate the object
        - Rotate all points back

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

          On 05/02/2013 at 13:03, xxxxxxxx wrote:

          ehm, how do i rotate points? if it has to do with matrixes , i guess i am completely lost 🙂

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

            On 05/02/2013 at 18:35, xxxxxxxx wrote:

            Yes, it has to do with matrices.   You can create the matrix very easily using HBPToMatrix() using the rotations used to rotate the object but negated (to go the other direction).  Then you multiply the points (vertices) by the matrix.

            Vector rot = obj->GetRelRot();  
            rot =    -rot;  
            Matrix rotmtx = HPBToMatrix(rot, ROTATIONORDER_DEFAULT);  
            // Object obj must be a PointObject(PolygonObject)  
            Vector* pts = obj->GetPoints();  
            if (!pts)     return FALSE;  
            LONG        ptCnt =    obj->GetPointCount();  
            for (LONG i = 0L; i != ptCnt; ++i)  
            {  
              pts[i] = pts[i] * rotmtx;  
            }
            
            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              On 05/02/2013 at 21:41, xxxxxxxx wrote:

              thank you! i totally forgot about HBPToMatrix. and thank you for the snippet. that helped me alot 🙂

              cheers,
              ello

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