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
    1. Maxon Developers Forum
    2. Tudor
    3. Best
    T
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 13
    • Best 1
    • Controversial 0
    • Groups 0

    Best posts made by Tudor

    • RE: Quaternion rotation

      I thought I can use this direction vector as Quaternion-Axis. The cam should point than to the target.
      But but it seems i need a different approach.

      import c4d, math
      
      cam = op.GetObject()
      target = op[c4d.ID_USERDATA,1]
      
      def main():
         tarPos = target.GetAbsPos()
         camPos = cam.GetAbsPos()
      
      
         direction = (tarPos - camPos).GetNormalized()
         angle = math.pi/2  #?
      
         q = c4d.Quaternion()
         q.SetAxis(direction, angle)
         b = q.GetMatrix()
         b.off = cam.GetAbsPos()
         cam.SetMg(b)
      
      posted in Cinema 4D SDK
      T
      Tudor