[Include] 3DTryg Functions
#21

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.
Reply
#22

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

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

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!
Reply
#25

Modulo works only for integer values.
Reply
#26

good good
Reply
#27

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
Reply
#28

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); 
Reply
#29

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
Reply
#30

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); 
Reply
#31

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); 
Reply
#32

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
Reply
#33

Update v2.9.2:

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

Can you add something like IsPlayerOnPlayerScreen?
Reply
#35

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
Reply
#36

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.)
Reply
#37



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

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 
Reply
#39

Good work, +rep.
Reply
#40

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

Like, bool:testLOS
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)