CastRay question
by Steve Lamperti · in Torque Game Engine · 03/22/2004 (11:03 am) · 4 replies
I'm trying to write a simple routine to do a castray directly below a point, and see if there is a collision. I am most likely doing something very silly, and I was hoping someone could look at the code below and point it out.
It may be something as simple as it not being correct to assume that z-.5 is directly below z, if x and y don't change.
Thanks,
It may be something as simple as it not being correct to assume that z-.5 is directly below z, if x and y don't change.
Thanks,
//
// JSL - check below the camera to see where the ground is
//
double BumpIntoTheGround(Point3F& start)
{
Point3F end;
bool result;
RayInfo rinfo;
end.x = start.x;
end.y = start.y;
end.z = start.z - .5;
result = gServerContainer.castRay(start, end, TerrainObjectType, &rinfo);
if (result)
return(rinfo.point.z);
return(0.0);
}
#2
03/22/2004 (12:01 pm)
Move this to private SDK : Torque source is NOT for public forums ;)
#3
you're right, that's what I meant to do. I want to check to see if there's anything directly below me.
@Nicolas, Sorry, can I move a post, or just start over in the right forum?
03/22/2004 (1:20 pm)
@badguy you're right, that's what I meant to do. I want to check to see if there's anything directly below me.
@Nicolas, Sorry, can I move a post, or just start over in the right forum?
#4
03/27/2004 (5:16 pm)
Just start over is best.
Torque Owner Badguy
cause you are only casting down .5
what if it looks like this:
0 <- height
1 <- .5 down
-------------- <- terrain
in this example nothing was hit.