for(i=0;i<num_OfEnemyOrcs;i++) {
Npcs.Render();
CVector3 pPoint=ClosestPointOnLine(GetCam().Position(),GetCam().View(), Npcs.origin);
CVector3 pom=pPoint-GetCam().Position();
pom = Normalize(pom);
print("%f %f %f",pPoint.x,pPoint.y,pPoint.z);
CVector3 *center=&Npcs.origin;
if(abs(pPoint.x-center->x)<50)
{
if(abs(pPoint.y-center->y)<50)
{
if(abs(pPoint.z-center->z)<50)
{
float dis=Distance3(pPoint,GetCam().Position());
if (!col || dis<mdist)
{
col=true;
mdist=dis;
colObj=i;
}
}
}
}
}
Tho that doesn't seem to work :(. Has anyone got a better solution or a fix? Thanks!
ray collision to check what the camera is pointing on
Hey guys,
this is basically an easy thing but I can't figure out why it isn't working:
I want to check if my Camera is pointing on some object, if it is a bool should be returned as true. I've been trying to do it like this:
www.prsoftware.de
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement