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

    Children Retaining Their Own Rotation

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 436 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

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

      On 10/09/2012 at 12:07, xxxxxxxx wrote:

      Hello,  I'm running into a problem with the rotation of an object created by a Python Generator.    I want the object returned by it to always stay at the same position, rotation and scale, regardless of what happens to the Python Generator object and any parent it might have.  I have the position not moving with :

        
      StayStillObj.SetAbsPos(StayStillObj.GetMg().off - op.GetMg().off)  
      

      How would I do a similar thing with rotation?

        
      def GetGlobalRotation(obj) :  
        return utils.MatrixToHPB(obj.GetMg())  
        
        
      StayStillObj.SetAbsRot(-GetGlobalRotation(op))  
      

      But that doesn't work once more then one axis is rotated.Any ideas of how to get that working?   Any help would be greatly appreciated.

      Daniel

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

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

        On 10/09/2012 at 12:36, xxxxxxxx wrote:

        Setting the childs' matrix to the inversed matrix of the parent-object negates the effect of the parent-matrix. Multiply with another matrix to specify the childs' matrix in global space.

        obj.SetMg(~op.GetMg()) * offset_matrix
        

        Use SetMl()/GetMl() to make the effect rely on the local space instead of the global space.

        -Niklas

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

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

          On 10/09/2012 at 15:26, xxxxxxxx wrote:

          Thanks, Niklas.

          Wouldn't it be :

            
              
              
              obj.SetMg(~op.GetMg() * offset_matrix  )
          

          And in this case what would offset_matrix be?

          When I do:

            
          child.SetMg(~parent.GetMg())  
              
          

          The child is rotated to a randomish rotation.

          Dan

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

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

            On 11/09/2012 at 01:08, xxxxxxxx wrote:

            > >> Wouldn't it be :
            Yes, I'm sorry. That was a mistake. 😃

            Here's a little example.

            Cheers,
            -Niklas

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

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

              On 11/09/2012 at 09:00, xxxxxxxx wrote:

              Thanks again, Niklas.

              That wasn't exactly what I wanted, I wanted global not local but you had already mentioned how to do that, so double thanks.

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