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

    Need to change rotation order of camera object

    Cinema 4D SDK
    3
    6
    1.5k
    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.
    • G
      gogeta
      last edited by gogeta

      HI Team,

      I am facing a strange issue as I am not able to change the "rotation order" of my camera object from HPB to XYZ or to anything else(for both local and global). I am using cameraObj->SetRotationOrder(ROTATIONORDER_XYZLOCAL); but it is not changing the rotation order of the camera object. It is always giving the same result i.e. default HPB order. I have also used cameraObj->SetParameter(); But no success.

      How can I change the rotation order to whatever I want? Please help me.

      Thanks in advance.

      1 Reply Last reply Reply Quote 0
      • S
        s_bach
        last edited by

        Hello,

        I tried it in R20 and it seems to work fine:

        CameraObject* const cam = static_cast<CameraObject*>(object);
        
        cam->SetRotationOrder(ROTATIONORDER::XYZLOCAL);
        

        Do you call EventAdd() after you changed the object? Can you show your code?

        best wishes,
        Sebastian

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        G 1 Reply Last reply Reply Quote 0
        • G
          gogeta @s_bach
          last edited by

          @s_bach HI Sebastian,

          I tried your suggestion of adding EventAdd() after changing the rotation order but it didn't work. Also, I am sorry I can't show the code to you because of some disclosure issues.
          Can you please suggest some other ways to change the rotation order of the camera object?
          I am trying to rotate the camera order inside User Area functions.

          Thanks in Advance.

          1 Reply Last reply Reply Quote 0
          • r_giganteR
            r_gigante
            last edited by

            Hi gogeta, thanks for following up.

            With regard to what suggested by @s_bach I confirm it's actually working without any hassle in the code snippet below.

            {
            	if (!doc)
            		return maxon::IllegalArgumentError(MAXON_SOURCE_LOCATION);
            	
            	BaseObject* activeObj = doc->GetActiveObject();
            	if (!activeObj || !activeObj->IsInstanceOf(Ocamera))
            	{
            		DiagnosticOutput("No camera selected");
            		return maxon::OK;
            	}
            	
            	ROTATIONORDER rotOrder = activeObj->GetRotationOrder();
            	DiagnosticOutput("current camera rotation order: @", rotOrder);
            	activeObj->SetRotationOrder(ROTATIONORDER::XYZGLOBAL);
            	EventAdd();
            	rotOrder = activeObj->GetRotationOrder();
            	DiagnosticOutput("new camera rotation order: @", rotOrder);
            	
            	return maxon::OK;
            }
            

            With regard to your case, would also great if you could better elaborate:

            I am trying to rotate the camera order inside User Area functions.

            Last but not least, it would be very handy to check the code you're using or at least to discuss the design you're implementing to better understand what's wrong. If you don't feel safe to share here consider to send an email to [email protected].

            Cheers, Riccardo

            G 1 Reply Last reply Reply Quote 0
            • G
              gogeta @r_gigante
              last edited by

              @r_gigante Hi Riccardo,
              Sorry for the late reply but I was not able to achieve the same with your code as well. But I did some tweaks with regards to the planes and it is working fine now.
              Though I appreciate your help a lot. Thank you guys for the help😇 .

              Regards
              Gogeta

              1 Reply Last reply Reply Quote 0
              • r_giganteR
                r_gigante
                last edited by

                Hi Gogeta, glad that in the end it worked out properly.

                Please, in order to close the topic, mark the post that actually solved your initial question or simply mark the thread as solved from the Topic Tools menu

                Cheers, Riccardo

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