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

    GeRayCollider

    Scheduled Pinned Locked Moved SDK Help
    2 Posts 0 Posters 228 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 21/05/2010 at 15:35, xxxxxxxx wrote:

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

      ---------
      Hey everyone.

      I am trying to determine if a point has collided with a polygon.  I am toying around with

      GeRayCollider to test for this.

      This is the code I am using.

      AutoAlloc<GeRayCollider> rCollider; 
      			if (!rCollider) return TRUE;
        
      			Vector dir = position;
      			Real ray_length = Len(objPoly->GetRad()*2.01);
        
      			if (bc->GetBool(COLLISION_ENABLE) == TRUE)
      			{
        
      					rCollider->Init(objPoly, FALSE);
      					Bool doesCollide = rCollider->Intersect(position,dir, ray_length, TRUE);
        
      					if (doesCollide)
      					{
      						velocity = -velocity;
      					}
        
                                 
      			}
        
        
      
      

      position = the position of the point

      I am not getting the results I expect.    I am wondering if I am using this function incorrectly?

      Any help you can offer would be greatly appreciated.

      ~Shawn

      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 24/05/2010 at 07:50, xxxxxxxx wrote:

        Howdy,

        Making the direction vector equal to the position vector means that the direction vector is pointing outward (going from 0,0,0 to position). So, your ray is starting at the position and pointing away from the collision object.

        What you need to do is calculate a starting point that is outside of the collision object's bounds, and make the ray from that start vector to the position vector to do the intersection test.

        Adios,
        Cactus Dan

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