Cant get GeRayCollider to work



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

    On 17/06/2005 at 16:08, xxxxxxxx wrote:

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

    ---------
    Hi,

    Im having a small problem trying to get the GeRayCollider to actually return an intersection

    This is what I have right now

      
         poly = static_cast<PolygonObject*>(op);  
         GeRayCollider *rc = NULL;  
         GeRayColResult res;  
         rc = GeRayCollider::Alloc();  
         rc->Init(poly, TRUE);  
      
         if(rc->Intersect(Vector(0,100,0), Vector(0,-1,0), 1000000))  
         {  
              // This doesnt intersect!  
              rc->GetNearestIntersection(&res;);  
              LONG k = res.distance;  
         }  
           
         GeRayCollider::Free(rc);  
    

    where op is a BaseObject. The object I am testing it on is a simple plane at its default position and orientation.

    I am simply trying to check for an intersection from point [0,100,0], and its direction directly down.
    The above code *should* be finding an intersection, but it doesn't. And not sure why

    Any ideas?

    Thanks



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

    On 18/06/2005 at 04:21, xxxxxxxx wrote:

    After more playing, it seems it doesn't work for the plane object

    The above code finds an intersection on all the primitive objects except the plane object.

    I dont understand why.

    At first I though maybe it wasn't finding an intersection due to the thickness of the plane (although this shouldn't matter), but the code finds an intersection on the polygon primitive.

    I'm stumped



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

    On 18/06/2005 at 04:58, xxxxxxxx wrote:

    If you're really in need of robust intersections you are probably better off doing it yourself since only you know what you need from it (accuracy, special cases, precalcs). If you write your own you can make it handle exactly what you need in the way you need. Intersections are very simple to write and there are many methods to speed them up depending on what the input data is going to be and how you want to look up the intersection. The internal ray collider may not be the best way for whatever you are doing.



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

    On 18/06/2005 at 07:22, xxxxxxxx wrote:

    I have already wrote my own ray colliding class some time ago I might add, but it contained a bug where it was returning the incorrect distance from intersection (and at the time distance wasn't important for me).

    Never had chance to fix it.

    I will eventually use it though as it was faster than the GeRayCollider class. Its just the GeRayCollider is there for a quick convience to test out code (when I finally got it to work!)

    Just confused why it would not intersect a simply plane, while other primitives work just fine


Log in to reply