Can someone please share some code of your ray cast function if you are using directx,
I have been stuck on this problem for months, tried a million different ways of making rays, nothing works
Moderators: Sascha Willems, walaber

function RayPrefilterCallback(const body : PNewtonBody; const collision : PNewtonCollision; userData : Pointer) : cardinal; cdecl;
begin
Result := 1;
end;
var
PickedParam : Float;
PickedBody : PNewtonBody;
function RayFilterCallback( const body : PNewtonBody; const hitNormal: PFloat; collisionID : Int; userData: Pointer; intersetParam: Float ) : Float; cdecl;
begin
if intersetParam < PickedParam then
begin
PickedParam := intersetParam;
PickedBody := body;
end;
Result := intersetParam;
end;PickedBody := Nil;
PickedParam := 1.1;
NewtonWorldRayCast(World,Point1,Point2,@RayFilterCallback,Nil,@RayPrefilterCallback);
static unsigned RayCastPrefilter (const NewtonBody* body, const NewtonCollision* collision, void* userData)
{
//if(NewtonCollisionIsTriggerVolume(collision))return 0;
dFloat mass;
dFloat Ixx;
dFloat Iyy;
dFloat Izz;
NewtonBodyGetMassMatrix (body, &mass, &Ixx, &Iyy, &Izz);
extern float Display;
Display = mass; //Prints to the screen, the mass, so if it says 1 then theres a collision with a chair, if 0 then its level
return (mass > 0.0f) ? 1 : 0;
}

if (mass > 0.0f) Display = mass; //Prints to the screen, the mass, so if it says 1 then theres a collision with a chair, if 0 then its level


Users browsing this forum: No registered users and 414 guests