26.01.2015, 09:18
(
Последний раз редактировалось codectile; 29.01.2015 в 16:50.
)
Is Object In Line Of Vector Scale
Introduction
This function checks whether a specified object is within the specified limit of the player's camera's front vector "scale".
Retruns 1, if the object is lies within player's camera's front vector "scale", else return 0. You must be very accurate with the camera to use this function. If the "limit" is negative, it will perform the same thing, but behind the camera/player.
Source Code
Introduction
This function checks whether a specified object is within the specified limit of the player's camera's front vector "scale".
Retruns 1, if the object is lies within player's camera's front vector "scale", else return 0. You must be very accurate with the camera to use this function. If the "limit" is negative, it will perform the same thing, but behind the camera/player.
Source Code
Код:
stock IsObjectInLOVS(playerid,objectid,Float:limit=30.0)
{
new
Float:X, Float:Y, Float:Z,
Float:VX, Float:VY, Float:VZ,
Float:object_x, Float:object_y, Float:object_z,
Float:_x,Float:_y,Float:_z,Float:dist;
GetPlayerPos(playerid, X, Y, Z);
GetObjectPos(objectid,object_x,object_y,object_z);
for(new i=0;i<=limit;i++)
{
GetPlayerCameraFrontVector(playerid, VX, VY, VZ);
_x = X + VX*i;
_y = Y + VY*i;
_z = Z + VZ*i;
dist=floatsqroot(((object_x - _x)*(object_x - _x))+((object_y - _y)*(object_y - _y))+((object_z - _z)*(object_z - _z)));
if(dist <= 1.0) return 1;
}
return 0;
}

