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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    GeRayCollider and viewports

    SDK Help
    0
    3
    294
    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
      Helper
      last edited by

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

      On 30/11/2003 at 05:45, xxxxxxxx wrote:

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

      ---------
      Hi
      Is there a known problem with using the GeRayCollider class on the 2D viewports?

          
          
          
          
           if (rc->GetNearestIntersection(&res))  
           {
          
          
          
          
           GePrint("Detected");  
           }
          
          
          
      

      On the perspective viewport,  'Detected' always prints when mouse cursor is over object.
      On 2D viewports, 'Detected' always prints using standard primitives like Sphere, but using my own model, it doesn't print Detected.
      Its really strange and I dont know what is causing it

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

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

        On 30/11/2003 at 07:37, xxxxxxxx wrote:

        GeRayCollider shouldn't care about the viewports since it always operates in 3D. Have you checked that the values you send to it are sensible? (I.e. what's in 'res', the part of the code that we cannot see.)

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

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

          On 30/11/2003 at 11:54, xxxxxxxx wrote:

          After some experimenting around, I found its just the one model that is causing me problems. I dont know why the model would be a problem as its just a simple face mesh.
          anyway, just incase you can see something not right here is my code

              
              
              
              
              Bool Toolplugin::GetCursorInfo(BaseDocument *doc, BaseContainer &data, BaseDraw *bd, Real x, Real y, BaseContainer &bc)  
              {
              
              
              
              
               GeRayCollider* rc=NULL;  
               GeRayColResult res;  
                    
               rc = GeRayCollider::Alloc();  
               obj= doc->GetActiveObject();
              
              
              
              
               // Make sure RayCollider is there  
               if (!rc)  
               {  
                GePrint("ERROR - RayCollider not Initialized");  
                return FALSE;  
               }
              
              
              
              
                 
               wtail = bd->SW(Vector(x,y,0));  
               whead = bd->SW(Vector(x,y,10000.0));  
               otail = (!obj->GetMg()) * wtail;  
               oray = (whead - wtail) ^ (!obj->GetMg());
              
              
              
              
                
               rc->Init(obj,TRUE);  
               rc->Intersect(otail, !oray, 10000.0);  
                 
                 
               if (rc->GetNearestIntersection(&res))  
               {  
                  
                GePrint("Detected: " + LongToString(res.face_id));   
                  
               }
              
              
              
              
               return TRUE;  
              }  
              
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post