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
    The Maxon SDK Team is currently short staffed due to the winter holidays. No forum support is being provided between 15/12/2025 and 5/1/2026. For details see Maxon SDK 2025 Winter Holidays.

    World matrix of camera

    Scheduled Pinned Locked Moved SDK Help
    6 Posts 0 Posters 468 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 16/05/2013 at 06:45, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R14+ 
      Platform:   Windows  ;   
      Language(s) :

      ---------
      How can I get the world matrix of the scene camera in a parallel view such as Left?

      BaseObject->GetMg() on the scenecamera returns the rotation portion as an identify matrix.

      Markus

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

        On 16/05/2013 at 06:52, xxxxxxxx wrote:

        The matrix does not only contain the rotation and with it the scale, but also the position. You can
        access it via the off attribute.

        Best,
        -Niklas

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

          On 17/05/2013 at 03:18, xxxxxxxx wrote:

          Sorry. I don't understand.

          I have a "Left" Camera.
          I do:

          BaseDraw* editor = doc->GetActiveBaseDraw();
                if (!editor)
                    return false;
                cam = editor->GetSceneCamera(doc);
                if (!cam)
                    return false;
                Matrix camRotMat = cam->GetMg();

          I get:
           [1 0 0
            0 1 0
            0 0 1
            0 0 0]

          Which is obviously wrong.

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

            On 17/05/2013 at 03:33, xxxxxxxx wrote:

            the matrix is correct. orthogonal cameras are not aligned like perspective cameras. every 
            orthogonal has that matrix unless you do specifically rotate them.

            edit : the offset can vary of course ...

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

              On 17/05/2013 at 04:35, xxxxxxxx wrote:

              Sorry I totally disagree that the matrix is correct.

              How can I offset the camera to the right if I don't know which axis that is?

              i.e.
              CameraObject->SetOffset(CameraObject->GetOffset() + Vector(100,0,0))

              only moves the camera left in the "Front", "Top" and "Botton: cameras (because the x-axis is to the right)

              Or is there another way of doing this?

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

                On 21/05/2013 at 10:40, xxxxxxxx wrote:

                Originally posted by xxxxxxxx

                Or is there another way of doing this?

                Yep. To get the correct camera matrix use the BaseView instead. There the GetMg() function also gets the global object matrix of the current camera object. But this time it is correct.

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