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

    fit camera viewport to object size

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 312 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 22/03/2013 at 09:01, xxxxxxxx wrote:

      Example, i have a plane in x/y and an orthogonal camera with an offset in z. Is it possible via script or plugin to zoom the camera, that the viewport shows exactly the polygon object plane? i know this depends on the render aspect ratio, but this is given by the plane. thanks

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

        On 22/03/2013 at 10:23, xxxxxxxx wrote:

        Hi Helge!
        I seems that an ortho camera placed at 0 ,0, 0 with a zoom factor of 1, will cover a plane (facing the camera) placed at 0, 0, 0 that measures 1024 cm in width regardless of your render resolution. So if your object is 2048 cm wide, you'll have to set the camera zoom factor to 0.5. If your plane is 512 cm wide you'll have to set your cam zoom factor to 2.

        Cheers
        Bonsak

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

          On 25/03/2013 at 01:39, xxxxxxxx wrote:

          Jepp that is right, now i will do some math to calculate the camera zoom. thanks

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

            On 25/03/2013 at 02:16, xxxxxxxx wrote:

            Hi Helge,

            there was a thread here on the cafe about exactly this topic. I didn't test it, but the script should
            work for any camera perspective.

            https://developers.maxon.net/forum/topic/6903/7745_eventadd-doesnt-update-c4d&KW=without+drawViews&PID=32162#32162

            -Niklas

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