SA-MP Forums Archive
[Include] 3DTryg Functions - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] 3DTryg Functions (/showthread.php?tid=591010)

Pages: 1 2 3 4 5 6 7


Re: Get Point In Front 2D 3D - AbyssMorgan - 05.07.2016

Update v2.6 now:

- Fixed function:
PHP код:
GetPointInFrontOfCamera2D(playerid,&Float:tx,&Float:ty,Float:radius); 
- Added ColAndreas Functions:
PHP код:
MovePointCol(Float:StartX,Float:StartY,Float:StartZ,Float:EndX,Float:EndY,Float:EndZ,&Float:x,&Float:y,&Float:z);
GetPointInFront3DCol(Float:x,Float:y,Float:z,Float:rx,Float:rz,Float:radius,&Float:tx,&Float:ty,&Float:tz);
Float:GetPointInFrontOfPlayerCol(playerid,&Float:tx,&Float:ty,Float:radius);
Float:GetPointInFrontOfCamera2DCol(playerid,&Float:tx,&Float:ty,Float:radius);
GetPointInFrontOfCamera3DCol(playerid,&Float:tx,&Float:ty,&Float:tz,Float:radius,&Float:rx=0.0,&Float:rz=0.0);
Float:GetPointInFrontOfVehicle2DCol(vehicleid,&Float:tx,&Float:ty,Float:radius);
GetPointInFrontOfVehicle3DCol(vehicleid,&Float:tx,&Float:ty,&Float:tz,Float:radius,&Float:rx=0.0,&Float:rz=0.0); 
Notice: This function only working for ColAndreas Plugin. Include no requires ColAndreas plugin to use the other functions.


Re: Get Point In Front 2D 3D - Battlezone - 06.07.2016

Very useful stuff .. and interesting debate guys
Edit: someone explain me this please CompRotationFloat?


Re: Get Point In Front 2D 3D - AbyssMorgan - 06.07.2016

Comp - Compress, limits the range of values of rotation to <0.0:360.0). Frequently used internally.


Re: Get Point In Front 2D 3D - Battlezone - 06.07.2016

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
Comp - Compress, limits the range of values of rotation to <0.0:360). Frequently used internally.
Ahh my bad, thanks!


Re: Get Point In Front 2D 3D - AbyssMorgan - 06.07.2016

Modulo works only for integer values.


Re: Get Point In Front 2D 3D - GhostHacker - 06.07.2016

good good


Re: Get Point In Front 2D 3D - AbyssMorgan - 06.07.2016

Update v2.6.2:

- Added functions:
PHP код:
Get3DTrygPrecision(); //returns a string with the name of precision
Tryg3DMapAndreasFindZ(Float:x,Float:y,&Float:z); //-> CA_FindZ_For2DCoord / MapAndreasFindZ / MapAndreas_FindZ_For2DCoord 
Float:CalculatePercent(Float:value,Float:maxvalue); 
- Added ColAndreas extended functions:
PHP код:
//future
GetColAndreasVersion();
GetValidColAndreasVersion();
bool:IsValidColAndreas(version);
GetColAndreasVersionName(name[], value GET_COLANDREAS_VERSIONmaxdest sizeof name);
CheckColAndreasVersion(); 
- Added ColAndreas version checker


Re: Get Point In Front 2D 3D - AbyssMorgan - 07.07.2016

Update v2.6.3:

- Added ColAndreas functions:
PHP код:
GetPlayerCollisionFlags(playerid);
bool:IsCollisionFlag(value,flag);
Float:UndergroundFindZ(Float:x,Float:y,&Float:z=0.0);
Float:InteriorFindZ(Float:px,Float:py,Float:pz=1000.0,Float:size=2.0,&Float:z=0.0);
bool:IsPointInWater(Float:x,Float:y,Float:z=0.0);
bool:IsPointInUnderwater(Float:x,Float:y,Float:z);
bool:IsPointInAir(Float:x,Float:y,Float:z,bool:interior=false,Float:max_distance=2.2);
bool:IsPointInGround(Float:x,Float:y,Float:z,bool:interior=false,Float:max_distance=2.2);
bool:IsPointInUnderground(Float:x,Float:y,Float:z); 
- Added Collision Flag definitions:
PHP код:
POSITION_FLAG_WORLD
POSITION_FLAG_INTERIOR
POSITION_FLAG_AIR
POSITION_FLAG_GROUND
POSITION_FLAG_UNDERGROUND
POSITION_FLAG_WATER
POSITION_FLAG_UNDERWATER 
Video:
https://www.youtube.com/watch?v=dJUQKrBkeY8


Example Command:
PHP код:
CMD:getz(playerid){
    new 
Float:x,Float:y,Float:zbuffer[128], Float:tmpz;
    
GetPlayerPos(playerid,x,y,z);
    
    
SendClientMessage(playerid,0xFFFFFFFF," ");
    
    
format(buffer,sizeof buffer,"Player Z: {00FF00}%.4f",z);
    
SendClientMessage(playerid,0xFFFFFFFF,buffer);
    
    
CA_FindZ_For2DCoord(x,y,tmpz);
    
format(buffer,sizeof buffer,"CA_FindZ_For2DCoord: {00FF00}%.4f",tmpz);
    
SendClientMessage(playerid,0xFFFFFFFF,buffer);
    
    
UndergroundFindZ(x,y,tmpz);
    
format(buffer,sizeof buffer,"Underground: {00FF00}%.4f",tmpz);
    
SendClientMessage(playerid,0xFFFFFFFF,buffer);
    
    
InteriorFindZ(x,y,z,2.0,tmpz);
    
format(buffer,sizeof buffer,"Interior: {00FF00}%.4f",tmpz);
    
SendClientMessage(playerid,0xFFFFFFFF,buffer);
    
    new 
flag GetPlayerCollisionFlags(playerid);
    if(
IsCollisionFlag(flag,POSITION_FLAG_UNDERWATER)){
        
format(buffer,sizeof buffer,"Player under water");
    } else if(
IsCollisionFlag(flag,POSITION_FLAG_WATER)){
        
format(buffer,sizeof buffer,"Player in water");
    } else if(
IsCollisionFlag(flag,POSITION_FLAG_AIR)){
        
format(buffer,sizeof buffer,"Player in air");
    } else if(
IsCollisionFlag(flag,POSITION_FLAG_UNDERGROUND)){
        
format(buffer,sizeof buffer,"Player underground");
    } else if(
IsCollisionFlag(flag,POSITION_FLAG_GROUND)){
        
format(buffer,sizeof buffer,"Player on ground");
    }
    if(
IsCollisionFlag(flag,POSITION_FLAG_WORLD)){
        
format(buffer,sizeof buffer,"%s (World)",buffer);
    } else if(
IsCollisionFlag(flag,POSITION_FLAG_INTERIOR)){
        
format(buffer,sizeof buffer,"%s (Interior)",buffer);
    }
    
SendClientMessage(playerid,0xFFFFFFFF,buffer);
    
    if(
IsPointInWater(x,y)){
        
SendClientMessage(playerid,0xFFFFFFFF,"This XY point on Water");
    } else {
        
SendClientMessage(playerid,0xFFFFFFFF,"This XY point on Ground");
    }
    return 
1;

Update v2.6.4:

- Added MapAndreas / ColAndreas function:
PHP код:
bool:IsPointInWaterFrontOfPlayer(playerid,Float:radius); 
- Fix missing params bool:interior for:
PHP код:
bool:IsPointInGround(Float:x,Float:y,Float:z,bool:interior=false,Float:max_distance=2.2); 



Re: Get Point In Front 2D 3D - AbyssMorgan - 09.07.2016

Update v2.6.6:

- Added functions:
PHP код:
bool:IsPointInCircle(Float:px,Float:py,Float:x,Float:y,Float:size)
bool:IsPointInSphere(Float:px,Float:py,Float:pz,Float:x,Float:y,Float:z,Float:size);
bool:IsPointInRectangle(Float:x,Float:y,Float:minx,Float:miny,Float:maxx,Float:maxy);
bool:IsPointInCube(Float:x,Float:y,Float:z,Float:minx,Float:miny,Float:minz,Float:maxx,Float:maxy,Float:maxz);
bool:IsPointInPolygon(Float:x,Float:y,{Float,_}:...); //Polygon Test by RyDeR SRC:https://sampforum.blast.hk/showthread.php?pid=1154971#pid1154971 
- Already exists function:
PHP код:
bool:IsPointInCylinder(Float:px,Float:py,Float:pz,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:size); 
- Added ColAndreas functions:
PHP код:
MovePointColCutLine(Float:SX,Float:SY,Float:SZ,Float:EX,Float:EY,Float:EZ,&Float:x,&Float:y,&Float:z,Float:cut_size=0.0);
MovePointColCutLineEx(Float:SX,Float:SY,Float:SZ,Float:EX,Float:EY,Float:EZ,&Float:x,&Float:y,&Float:z,Float:cut_size=0.0); //for EngineV6 
- Already exists definitions:
PHP код:
FLOAT_PI pi constant value 
See also:
EngineV6 Thread


Re: Get Point In Front 2D 3D - AbyssMorgan - 24.07.2016

Update v2.7.0:

- Added support for YSF IS4 Version and YSF Kurta999 Version
- Increase MAX_POLYGON_POINTS from 32 to 256
- Added functions:
PHP код:
Float:GetVehicleSpeed(vehicleid);
Float:GetPlayerSpeed(playerid);
Get3DTrygModules(&modules_count=0); //previous version: Get3DTrygPrecision();
CreateDynamicExplosion(Float:x,Float:y,Float:z,type,Float:radius,worldid=-1,interiorid=-1,playerid=-1,Float:distance=200.0); 
- Added YSF functions:
PHP код:
Float:GetPlayerHydraReactorRX(playerid);
GetPlayerRotation(playerid,&Float:rx,&Float:ry,&Float:rz);
GetPlayerTimeline(playerid);
SetPlayerTimeline(playerid,timeline);
GetPlayerPos4D(playerid,&Float:x,&Float:y,&Float:z,&timeline);
SetPlayerPos4D(playerid,Float:x,Float:y,Float:z,timeline=0); 
- Added YSF extended functions:
PHP код:
UpdatePlayerTimeline(playerid); 
- Update syntax:
PHP код:
//from:
bool:IsPointInPolygon(Float:x,Float:y,{Float,_}:...); 
//to:
bool:IsPointInPolygon(Float:x,Float:y,Float:points[],maxpoints sizeof(points)); 
- Deleted function:
PHP код:
Get3DTrygPrecision(); 
- Fixed function:
PHP код:
GetVehicleRotation(vehicleid,&Float:rx,&Float:ry,&Float:rz); 



Re: Get Point In Front 2D 3D - AbyssMorgan - 05.09.2016

Update v2.9.0:

- Updated function:
Код:
CountPlayers(bool:isplayer=true,bool:isnpc=true);
- Fixed function:
PHP код:
bool:IsPlayerInPolygon(playerid,Float:points[],maxpoints sizeof(points)); 
- New Support for FCNPC Plugin

- Added FCNPC Functions:
PHP код:
bool:IsNPCInCircle(npcid,Float:x,Float:y,Float:radius);
bool:IsNPCInCylinder(npcid,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:radius);
bool:IsNPCInCylinderEx(npcid,Float:x,Float:y,Float:minz,Float:maxz,Float:radius);
bool:IsNPCInSphere(npcid,Float:x,Float:y,Float:z,Float:radius);
bool:IsNPCInRectangle(npcid,Float:minx,Float:miny,Float:maxx,Float:maxy);
bool:IsNPCInCube(npcid,Float:minx,Float:miny,Float:minz,Float:maxx,Float:maxy,Float:maxz);
bool:IsNPCInPolygon(npcid,Float:points[],maxpoints sizeof(points));
Float:GetPointInFrontOfNPC(npcid,&Float:tx,&Float:ty,Float:radius);
GetNPCOrientationPos(npcid,element_orientation:orientation,Float:distance,&Float:tx,&Float:ty,&Float:tz);
Float:GetNPCDistanceFromPoint(npcid,Float:x,Float:y,Float:z);
bool:IsNPCInRangeOfPoint(npcid,Float:range,Float:x,Float:y,Float:z);
Float:GetDistanceBetweenNPCs(npcid_a,npcid_b);
Float:GetNPCSpeed(npcid);
Float:GetNPCTargetAngle(npcid,Float:x,Float:y,&Float:rz=0.0);
Float:SetNPCTargetAngle(npcid,Float:x,Float:y,&Float:rz=0.0);
Float:GetNPCTargetNPCAngle(npcid,targetid,&Float:rz=0.0);
Float:SetNPCTargetNPCAngle(npcid,targetid,&Float:rz=0.0);
Float:GetNPCActorDistance(npcid,actorid);
Float:GetNPCVehicleDistance(npcid,vehicleid);
Float:GetNPCObjectDistance(npcid,objectid);
bool:GetNPCToPointVector(npcid,Float:tx,Float:ty,Float:tz,&Float:vx,&Float:vy,&Float:vz);
GetNPCRotatedVector(npcid,Float:tx,Float:ty,Float:tz,&Float:vx,&Float:vy,&Float:vz,bool:return_vector=true,Float:rx=0.0,Float:ry=0.0,Float:rz=0.0); 
- Added FCNPC Functions (ColAndreas):
PHP код:
Float:GetPointInFrontOfNPCCol(npcid,&Float:tx,&Float:ty,Float:radius);
GetNPCCollisionFlags(npcid);
bool:IsBetweenNPCsIsWall(npcid,targetid);
bool:IsBetweenNPCToPointIsWall(npcid,Float:x,Float:y,Float:z);
GetNPCOrientationPosCol(npcid,element_orientation:orientation,Float:distance,&Float:tx,&Float:ty,&Float:tz); 
- Added FCNPC Functions (ColAndreas OR MapAndreas):
PHP код:
bool:IsPointInWaterFrontOfNPC(npcid,Float:radius); 
- Added FCNPC Functions (Streamer):
PHP код:
Float:GetNPCDynamicObjectDistance(npcid,objectid); 



Re: Get Point In Front 2D 3D - AbyssMorgan - 17.09.2016

Update v2.9.1:

- Update FCNPC Module v1.3.0

- Added Functions:
PHP код:
bool:IsVehicleInRangeOfPoint(vehicleid,Float:range,Float:x,Float:y,Float:z);
bool:IsActorInRangeOfPoint(actorid,Float:range,Float:x,Float:y,Float:z);
bool:IsObjectInRangeOfPoint(objectid,Float:range,Float:x,Float:y,Float:z);
Float:GetObjectDistanceFromPoint(objectid,Float:x,Float:y,Float:z); 
- Added Streamer Functions:
PHP код:
Float:GetDynamicObjectDistFromPoint(objectid,Float:x,Float:y,Float:z);
bool:IsDynamicObjectInRangeOfPoint(objectid,Float:range,Float:x,Float:y,Float:z); 
- Added FCNPC Functions:
PHP код:
FCNPC_SetVehicleRotation(npcid,Float:rx,Float:ry,Float:rz);
bool:FCNPC_SetVehicleTargetRotation(npcid,Float:tx,Float:ty,Float:tz,Float:ry=0.0); 
- Added FCNPC Functions (ColAndreas):
PHP код:
FCNPC_GoToCol(npcid,Float:x,Float:y,Float:z,type MOVE_TYPE_AUTO,Float:speed MOVE_SPEED_AUTO,bool:UseMapAndreas false,Float:cut_size 0.0,bool:setangle true);
FCNPC_GoToPlayerCol(npcid,playerid,type MOVE_TYPE_AUTO,Float:speed MOVE_SPEED_AUTO,bool:UseMapAndreas false,Float:cut_size 0.0,bool:setangle true); 
Video for FCNPC_SetVehicleRotation & FCNPC_SetVehicleTargetRotation:
https://www.youtube.com/watch?v=snZ-25QuBm0

- Example Code for FCNPC_SetVehicleTargetRotation:
PHP код:
FCNPC_SetVehicleTargetRotation(npcid,Float:x,Float:y,Float:z);
FCNPC_GoTo(npcid,Float:x,Float:y,Float:z,MOVE_TYPE_DRIVE,1.0,false,0.0,false); 
Download
3DTryg.inc


Re: Get Point In Front 2D 3D - AbyssMorgan - 02.10.2016

Update v2.9.2:

- Added support for MapAndreas 1.1.0 (MapAndreas 1.2.1 also supported)
- Added requirement SAMP 0.3.7


Re: Get Point In Front 2D 3D - ExTaZZ69 - 02.10.2016

Can you add something like IsPlayerOnPlayerScreen?


Re: Get Point In Front 2D 3D - AbyssMorgan - 03.10.2016

Quote:
Originally Posted by ExTaZZ69
Посмотреть сообщение
Can you add something like IsPlayerOnPlayerScreen?
Yes

Update v2.9.3:

- Added ColAndreas Function:
PHP код:
bool:IsPlayerOnPlayerScreen(playerid,targetid); 
Video:
https://www.youtube.com/watch?v=ih9P_Cwkz68


Re: Get Point In Front 2D 3D - Unrea1 - 04.10.2016

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
Yes

Update v2.9.3:

- Added ColAndreas Function:
PHP код:
bool:IsPlayerOnPlayerScreen(playerid,targetid); 
Video:
https://www.youtube.com/watch?v=ih9P_Cwkz68
The function works as follows?



If it does not work so you could improve that function, optionally adding a parameter of vision angle. And also another optional parameter to the player / npc see a certain distance (meters) ...

I would appreciate this improvement, as it will help to realism that is applied to the npc (either guards, zombies, etc.)


Re: Get Point In Front 2D 3D - AbyssMorgan - 04.10.2016



The function automatically retrieves the rotation of the camera, but for the NPC could be entered manually.


Re: Get Point In Front 2D 3D - AbyssMorgan - 04.10.2016

Update v2.9.4:

- Updated function:
Код:
bool:IsPlayerOnPlayerScreen(playerid,targetid,Float:rx=INVALID_ROTATION,Float:rz=INVALID_ROTATION,Float:vertical=VERTICAL_CAMERA_RADIUS,Float:horizontal=HORIZONTAL_CAMERA_RADIUS);
- Added ColAndreas function:
PHP код:
bool:IsPlayerOnFakeScreen(Float:x,Float:y,Float:z,targetid,Float:rx,Float:rz,Float:vertical=VERTICAL_CAMERA_RADIUS,Float:horizontal=HORIZONTAL_CAMERA_RADIUS); 
- Added Definitions:
PHP код:
VERTICAL_CAMERA_RADIUS
HORIZONTAL_CAMERA_RADIUS 



Re: Get Point In Front 2D 3D - Unrea1 - 04.10.2016

Good work, +rep.


Re: Get Point In Front 2D 3D - Crayder - 05.10.2016

Add a parameter to the screen functions to toggle whether or not collision detection is done.

Like, bool:testLOS