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

    Setting Quaternion from HPB

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 341 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 09/05/2016 at 06:57, xxxxxxxx wrote:

      Now that Cinema has quaternion object for Python, I've tried to use it and set it from HPB euler rotation, using Quaternion.SetHPB method.

      For some reason all I'm getting back is None. Is it a bug? Am I calling it wrong way? I'm fairly new to Python so I have no clue.

      Thanks for any guidance 🙂

      Here's my primitive code example:

      \> import c4d
      \> 
      \> rot = c4d.Vector()
      \> 
      \> print rot
      \> 
      \> #rotq = c4d.Quaternion().SetHPB(rot)
      \> 
      \> q = c4d.Quaternion()
      \> 
      \> rotq = q.SetHPB(rot)
      \> 
      \> print rotq
      

      **
      **
      "rot" prints Vector(0,0,0) as intended,

      "rotq" prints None 😞
      The chained approach doesn't work either.

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

        On 09/05/2016 at 07:48, xxxxxxxx wrote:

        Hi,

        Quaternion.SetHPB() doesn't return any value. (Look at its documentation.)
        SetHPB() is a setter method that calculates a quaternion direction vector and rotation angle from a HPB totation. So you should just print the q variable.

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

          On 09/05/2016 at 08:24, xxxxxxxx wrote:

          Thank you very much, I didn't recognize the pattern. Thanks for a quick reply!

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