Minimal raycast test won't work.
![Post Post](./styles/metrolike/imageset/icon_post_target.gif)
Not really sure what is going on here but I am trying to integrate newton into my current project for raycast selecting purposes (I don't need it for physics simulation). I tried to set up a minimal hello world raycast example but not getting any results. Any ideas of what I am doing wrong? Thanks in advance!
Here is the callback function. It is never printing the message and never getting to this callback.
Here is the main function.
I am using the latest windows version of newton.
Thanks again.
Here is the callback function. It is never printing the message and never getting to this callback.
- Code: Select all
dFloat FilterRayCast(const NewtonBody* body, const dFloat* normal, int collisionid, void* userdata, dFloat intersetparam)
{
printf("Hello world you hit me!\n");
return intersetparam;
}
Here is the main function.
- Code: Select all
NewtonWorld * world = NewtonCreate();
float min[3];
float max[3];
for(int i=0; i<3; i++)
{
min[i] = -1000;
max[i] = 1000;
}
NewtonSetWorldSize(world, min, max);
NewtonCollision * col = NewtonCreateBox(world, 10.0, 10.0, 10.0, 1, NULL);
NewtonBody * body = NewtonCreateBody(world, col);
float point1[3];
point1[0] = 50.0;
point1[1] = 0.0;
point1[2] = 0.0;
float point2[3];
point2[0] = -50.0;
point2[1] = 0.0;
point2[2] = 0.0;
printf("Shooting the ray...");
NewtonWorldRayCast(world, point1, point2, FilterRayCast, NULL, NULL);
I am using the latest windows version of newton.
Thanks again.