Virtual World Shooting
#2

maybe this will help you

Код:
Float:DistanceCameraTargetToLocation(Float:CamX, Float:CamY, Float:CamZ,  Float:ObjX, Float:ObjY, Float:ObjZ,  Float:FrX, Float:FrY, Float:FrZ)
{

	new Float:TGTDistance;

	// get distance from camera to target
	TGTDistance = floatsqroot((CamX - ObjX) * (CamX - ObjX) + (CamY - ObjY) * (CamY - ObjY) + (CamZ - ObjZ) * (CamZ - ObjZ));

	new Float:tmpX, Float:tmpY, Float:tmpZ;

	tmpX = FrX * TGTDistance + CamX;
	tmpY = FrY * TGTDistance + CamY;
	tmpZ = FrZ * TGTDistance + CamZ;

	return floatsqroot((tmpX - ObjX) * (tmpX - ObjX) + (tmpY - ObjY) * (tmpY - ObjY) + (tmpZ - ObjZ) * (tmpZ - ObjZ));
}
stock IsPlayerAimingAt(playerid, Float:x, Float:y, Float:z, Float:radius)
{
    new Float:cx,Float:cy,Float:cz,Float:fx,Float:fy,Float:fz;
    GetPlayerCameraPos(playerid, cx, cy, cz);
    GetPlayerCameraFrontVector(playerid, fx, fy, fz);
    return (radius >= DistanceCameraTargetToLocation(cx, cy, cz, x, y, z, fx, fy, fz));
}
Reply


Messages In This Thread
Virtual World Shooting - by Rolyy - 13.08.2010, 22:10
Re: Virtual World Shooting - by akis_tze - 13.08.2010, 22:17
Re: Virtual World Shooting - by Cameltoe - 13.08.2010, 22:30
Re: Virtual World Shooting - by Rolyy - 14.08.2010, 12:15
Re: Virtual World Shooting - by Claude - 14.08.2010, 12:20
Re: Virtual World Shooting - by Rolyy - 14.08.2010, 12:24
Re: Virtual World Shooting - by playbox12 - 14.08.2010, 12:29
Re: Virtual World Shooting - by Rolyy - 14.08.2010, 12:32
Re: Virtual World Shooting - by Vince - 14.08.2010, 12:37
Re: Virtual World Shooting - by playbox12 - 14.08.2010, 12:40

Forum Jump:


Users browsing this thread: 2 Guest(s)