On 06/07/2013 at 11:33, xxxxxxxx wrote:
Ok, amongst some of the mess I'm cleaning up in another topic... next query for the SH!
I'm trying to get a TRUE/FALSE return for the GeRayCollider->Intersect() in the SH's input to help me identify an object.
First question, will the GeRayCollider test for a class level variable poly object? I.e. can a class level poly object in the SH be used to test against with the ray?
Second, the SW() and SW_Reference() are a little confusing. If I want the ray to go from X,Y in screen space to some distance defined in the background (say 1,000,000 units directly behind the mouse click) which one do I use? Below is the code I'm using thus far:
Bool TestCollide = FALSE;
AutoAlloc<GeRayCollider> Collider;
Collider->Init(Cube, TRUE); // Cube is a class level PolyObj
Vector RayStart = bd->SW(Vector(Move_X_Start, Move_Y_Start, 0));
Vector RayEnd = bd->SW(Vector(Move_X_Start, Move_Y_Start, 100000000));
Bool TestCollide = FALSE;
TestCollide = Collider->Intersect(RayStart, RayEnd, 1, FALSE);
GePrint("Collider value = " + LongToString(TestCollide)); // always returns FALSE..
if(TestCollide){GePrint("Cube found!!");}
But it always returns FALSE. The coords given are in screen space, they appear to be printing correct values. I'm only wishing to test for a TRUE/FALSE hit, I have no need for anything else. Is what I'm doing above right?
Cheers,
WP.