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

    Help with Matrix

    Scheduled Pinned Locked Moved SDK Help
    5 Posts 0 Posters 458 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 29/05/2010 at 10:26, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   11.5 
      Platform:      Mac OSX  ; 
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      I'm struggling with dot syntax... Could somebody give me some guidance as to what I'm doing wrong...?

      I'm just trying to store the cube's X position.

      main(doc,op)
      {
      var cube=doc->FindObject("Cube");
      var cubeX = cube.x;
      }

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 29/05/2010 at 10:49, xxxxxxxx wrote:

        You've skipped a step. You must get the position from your object.

          
        var cube = doc->FindObject("Cube"); // this is just what object you want to use   
        var cubeposition = cube->GetPosition(); // This is the local position, vectors x y z.   
        var cubeposX = cubeposition.x; // Her you pick the x vector   
        

        Do read the basicsin the 9.5 COFFEE SDK
        (Found under "Older SDK" at Support Downloads)
        Most of the ideas behind programming is very well described in it.

        Cheers
        Lennart

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 29/05/2010 at 11:05, xxxxxxxx wrote:

          I see...

          Would you be able to help me with something else...?

          I'm trying to keep a null aligned to a spline using an offset specified in a user data field. When I move and rotate the spline, the null doesn't stay aligned because I can't figure out how to input the correct Matrix details. I know this would be simple in Xpresso, but I'm trying to learn COFFEE. I do have the SDK, but it can be difficult to find the answers at times. I would be really grateful for any pointers...

          main(doc,op)
          {
          var spline=doc->FindObject("Spline");
          var point=doc->FindObject("point");

          var offsetAmount=spline#ID_USERDATA:1;
          var offset=spline->GetSplinePoint(offsetAmount,0);

          point->SetPosition(offset);
          }

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 30/05/2010 at 06:28, xxxxxxxx wrote:

            This would be the basics for that. Your position along the spline need to be
            converted into Global space.
            Note that there is no easy way to get a deformed position.
            Also, do check the Init() function in the SDK if you want/need to do any calculations on the spline.

            Cheers
            Lennart

              
            main(doc,op)   
            {   
            var spline = doc->FindObject("Spline");   
            if(!spline) return; // Not found   
            var Cube = doc->FindObject("Cube");   
            if(!Cube) return; // Not found   
              
            var offsetAmount = spline#ID_USERDATA:1;   
            var offset = spline->GetSplinePoint(offsetAmount,0); // The local position along the spline   
                offset = spline->GetMg()->GetMulP(offset);// Get the global offset position   
              
            var CubeM = Cube->GetMg(); // Get the Cube matrix   
                CubeM->SetV0(offset); // Load new position (your offset) into Cube matrix   
                Cube->SetMg(CubeM);    // Reload the edited matrix back to Cube   
            }   
            
            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 30/05/2010 at 10:59, xxxxxxxx wrote:

              Thanks a lot Lennart, I've been through your help and it's working just as i wanted. You've given me some really good pointers.
              Benek

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