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
    • Recent
    • Tags
    • Users
    • Login

    Getting HPB values from matrix

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 411 Views
    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 Offline
      Helper
      last edited by

      On 07/07/2016 at 07:23, xxxxxxxx wrote:

      Hello.

      I frequently need to get the HOB rotation values from a matrix, and I don't like using the workaround of setting a dummy object's matrix with SetMg() then getting the HPB values with GetAbsRot().

      Does anyone have the formula handy? Thanks.

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

        On 07/07/2016 at 09:35, xxxxxxxx wrote:

        import c4d  
        def main() :  
           
          obj = doc.GetActiveObject()  
          if not obj: return  
            
          mg = obj.GetMg()  
          rot = c4d.utils.MatrixToHPB(mg)  
          
          print rot  
            
          c4d.EventAdd()   
          
        if __name__=='__main__':  
          main()
        

        -ScottA

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

          On 07/07/2016 at 10:33, xxxxxxxx wrote:

          Ah, yes. How embarrassing. Forgot about that..

          Thank you, Scott.

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

            On 08/07/2016 at 09:45, xxxxxxxx wrote:

            Thanks, Scott, for solving this issue 🙂

            Just a link for future readers, here's the docs of utils module, which contains quite a bunch of these little helpers.

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