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

    Move viewport camera from plugin

    General Talk
    3
    5
    1.3k
    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.
    • M
      mortenjust
      last edited by m_adam

      I'm playing around with an idea for a 3D mouse.

      I have this working Mouse > USB > my macOS app - and just need the last few steps: > Cinema 4D plug-in > Cinema 4D camera/rig rotation

      I'm wondering if I can write a plug-in that takes a set of rotation parameters (in any format, really, quarternion, euler angles, transform) and rotate the camera (or its rig parent node) to look from that angle.

      1. Is that even possible? I looked at the docs, and I could only find direct dragging functions.

      2. Also, what would be a good way to pass in the rotation parameters from my macOS app to the plugin? I'm thinking maybe a websocket. Ideally I'd pass in the rotation 60 times per second, but 15 could probably work, too.

      1 Reply Last reply Reply Quote 0
      • M
        mortenjust
        last edited by

        So! It looks like this might work for the rotation part, as long as there is a rig node.

        import c4d
        obj = GetCameraRigNode()
        
         def rotate(eulerX, eulerY, eulerZ):
            rot = c4d.Vector(eulerX, eulerY, eulerZ)
            obj.SetAbsRot(rot)
        

        For the transport I'm thinking about running a websockets server which the Python app will connect to and listen for rotation events.

        Unless there's something simpler I could do, like calling a url scheme, or passing parameters to C4D from cocoa.

        1 Reply Last reply Reply Quote 0
        • M
          m_adam
          last edited by m_adam

          Hi @mortenjust first of all welcome in the plugin cafe community.
          Don't worry since it's your first post, but please next time try to follow these rules:

          • Q&A New Functionality.
          • How to Post Questions especially the tagging part.
            I've set up this post correctly, but please for the next ones.

          Regarding your question, there is no building option in Cinema 4D, so the best way would be to have a TCP/Socket server to communicate across multiple application.

          Finally, in case you are not aware, there is already a plugin for handling 3D mouse called CallieMouse, but is not yet ported in R20, for more information see 3D Mouse Slider Focus

          Cheers,
          Maxime.

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

          1 Reply Last reply Reply Quote 1
          • M
            mortenjust
            last edited by

            Sorry if I did something wrong in my post, and thanks for the pointers.

            I made it work using Websocket. It's using augmented reality to orbit the camera live in Cinema. Here's a couple of videos if anyone's interested
            https://vimeo.com/album/5915686

            1 Reply Last reply Reply Quote 2
            • D
              dermesut
              last edited by

              wow! i love that.
              great job!

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