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:
Cinema 4D Version: 11.5
Platform: Windows ;
Language(s) : C++ ;
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.
if (!rCollider) return TRUE;
Vector dir = position;
Real ray_length = Len(objPoly->GetRad()*2.01);
if (bc->GetBool(COLLISION_ENABLE) == TRUE)
Bool doesCollide = rCollider->Intersect(position,dir, ray_length, TRUE);
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.
On 24/05/2010 at 07:50, xxxxxxxx wrote:
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.