GeRayCollider and viewports



  • 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



  • 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.)



  • 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;  
        }  
        
    

Log in to reply