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: 3DTryg Functions - Dayvison_ - 31.05.2017

Thanks a lot, in IsElementOnPlayerScreen you used GetPlayerCameraPos/Rotation, i did not know FCNPC_GetPosition/Angle will be the same result


With your math magic you can do a function like to get X,Y where element is visible on player camera?
https://www.youtube.com/watch?v=vYmV8j5P0X8


Re: 3DTryg Functions - AbyssMorgan - 31.05.2017

I need add ScreenToWorld and WorldToScreen functions


Re: 3DTryg Functions - DRIFT_HUNTER - 01.06.2017

AbyssMorgan, im pretty sure its already possible with these include but i just cant see it and i suck at math.

If i have actor, and i would like to implement SIGHT for him for example lets say 90 degree and 100 units far. How would i make it? When i say SIGHT i mean detect element that he can "see" by using his facing angle.


Re: 3DTryg Functions - AbyssMorgan - 01.06.2017

Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
AbyssMorgan, im pretty sure its already possible with these include but i just cant see it and i suck at math.

If i have actor, and i would like to implement SIGHT for him for example lets say 90 degree and 100 units far. How would i make it? When i say SIGHT i mean detect element that he can "see" by using his facing angle.
PHP код:
new Float:x,Float:y,Float:z,Float:z_angle;
GetActorPos(actorid,x,y,z);
GetActorFacingAngle(actorid,z_angle);
if(
IsElementOnFakeScreen(x,y,z,playerid,item_player,0.0,z_angle)){
//actor see player




Re: 3DTryg Functions - AbyssMorgan - 13.07.2017

Update v4.4.0:

- Update for FCNPC v1.7.3

- Fix random crash (Division by Zero):
PHP код:
GetRandomPointOnSphere
GetRandomPointInCircle 
- Fix FCNPC moving functions:
PHP код:
FCNPC_RandomMoveInDynamicArea
FCNPC_RandomMoveInStream 
- Added support for PLAYER_SPEED_MULTIPLIER:
PHP код:
GetNPCSpeed 
- Updated FCNPC functions:
Код:
FCNPC_RandomMoveInStream(npcid,Stream:StreamData[Stream3D],Float:climbing = 2.0,type = MOVE_TYPE_AUTO,Float:speed = MOVE_SPEED_AUTO,bool:UseMapAndreas = false,bool:setangle = true,Float:dist_offset = 0.0,stopdelay = 250);
FCNPC_RandomMoveInDynamicArea(npcid,STREAMER_TAG_AREA areaid,Float:climbing = 2.0,type = MOVE_TYPE_AUTO,Float:speed = MOVE_SPEED_AUTO,bool:UseMapAndreas = false,bool:setangle = true,Float:dist_offset = 0.0,stopdelay = 250);
FCNPC_GoToPlayerOnGroundCol(npcid,playerid,type = MOVE_TYPE_AUTO,Float:speed = MOVE_SPEED_AUTO,bool:UseMapAndreas = false,Float:cut_size = 1.0,Float:climbing = 2.0,bool:setangle = true,Float:dist_offset = 0.0,stopdelay = 250);
FCNPC_GoToAir(npcid,Float:x,Float:y,Float:z,type = MOVE_TYPE_AUTO,Float:speed = MOVE_SPEED_AUTO,Float:dist_offset = 0.0,stopdelay = 250);
FCNPC_GoToAirCol(npcid,Float:x,Float:y,Float:z,type = MOVE_TYPE_AUTO,Float:speed = MOVE_SPEED_AUTO,Float:cut_size = 0.0,Float:dist_offset = 0.0,stopdelay = 250);
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,Float:dist_offset = 0.0,stopdelay = 250);
FCNPC_GoToPlayerCol(npcid,playerid,type = MOVE_TYPE_AUTO,Float:speed = MOVE_SPEED_AUTO,bool:UseMapAndreas = false,Float:cut_size = 0.0,bool:setangle = true,Float:dist_offset = 0.0,stopdelay = 250);
- Added functions:
PHP код:
GenerateGangZone(Float:x,Float:y,Float:radius,&Float:minx,&Float:miny,&Float:maxx,&Float:maxy); 



Re: 3DTryg Functions - AbyssMorgan - 11.08.2017

Update v4.4.1:

- Update compiler messages

- Update SA:MP 0.3.7 includes checker

- Added compiler option:
PHP код:
ENABLE_3D_TRYG_YSI_SUPPORT   //Use before 3DTryg.inc for enable YSI Support (use only when 3DTryg say error for this) 
- Added universal function:
PHP код:
GetInvalidElementID(Item3D_Type:item_type); 
- Added functions:
PHP код:
GetVehicleDefaultFlagsByModel(modelid);
SetVehicleFlagsByModel(modelid,value);
ToggleVehicleModelFlag(modelid,flag,bool:toggle); 



Re: 3DTryg Functions - AbyssMorgan - 16.08.2017

Update v4.4.2:

- Update for FCNPC v1.7.4

- Fixed functions/callbacks
PHP код:
Tryg3D::GivePlayerDamage call to all scriptsOnPlayerGiveDamage and OnPlayerTakeDamage
OnColAndreasRemoveBuilding 
call to all scripts 
- Added support for FCNPC
PHP код:
Tryg3D::GivePlayerDamage 
- Added functions:
PHP код:
SetVehicleSpeed(vehicleid,Float:speed);
Float:GetCameraTargetDistance(Float:CamX,Float:CamY,Float:CamZ,Float:ObjX,Float:ObjY,Float:ObjZ,Float:FrX,Float:FrY,Float:FrZ);
IsPlayerAimingAt(playerid,Float:x,Float:y,Float:z,Float:radius);
//Explosion Damage Control support players/vehicles
//Player: Take/Give damage by weaponid 51, bodypart 3
//This function set player health to 765.0 before using explosion
CreateDynamicExplosionDMG(Float:x,Float:y,Float:z,type,Float:radius,worldid = -1,interiorid = -1,playerid = -1,Float:distance 200.0,Float:damage=82.5,Float:vehicle_damage=82.5,byplayerid=INVALID_PLAYER_ID);
SendFakeDamageInRadius(weaponid,bodypart,Float:damage,Float:vehicle_damage,Float:x,Float:y,Float:z,Float:radius,worldid = -1,interiorid = -1,playerid = -1,byplayerid=INVALID_PLAYER_ID); 
- Added IPL functions:
PHP код:
IPL_CreateObject(modelid,Float:x,Float:y,Float:z,Float:qx,Float:qy,Float:qz,Float:qw,Float:drawdistance=0.0);
IPL_CreateDynamicObject(modelid,Float:x,Float:y,Float:z,Float:qx,Float:qy,Float:qz,Float:qw,worldid=-1,interiorid=-1,playerid=-1,Float:streamdistance=STREAMER_OBJECT_SD,Float:drawdistance=STREAMER_OBJECT_DD,STREAMER_TAG_AREA areaid=STREAMER_TAG_AREA -1,priority=0); 
- IPL function example:
Код:
714, veg_bevtree2, 0, 2007.609375, -1556.65625, 12.59375, 0, 0, -0.7398733497, 0.6727461815, -1

IPL_CreateDynamicObject(714, 2007.609375, -1556.65625, 12.59375, 0, 0, -0.7398733497, 0.6727461815);
- IPL function example 2 (auto decode):
PHP код:
#define ipl_extract_params(%1,%2,%3,%4,%5,%6,%7,%8)        %1,%2,%3,%4,%5,%6,%7
#define ipl_decode(%0,%1,%2,%3)                            %0,ipl_extract_params(%3)
IPL_CreateDynamicObject(ipl_decode(714veg_bevtree202007.609375, -1556.6562512.5937500, -0.73987334970.6727461815, -1)); 
Video for SetVehicleSpeed:
https://www.youtube.com/watch?v=2YyP9EktcPU


Re: 3DTryg Functions - AbyssMorgan - 21.08.2017

Minor Update v4.4.3:

- Fix CreateDynamicExplosion for player in Vehicle

- Fix Tryg3D::GivePlayerDamage for NPC (OnPlayerDeath not called)

- Update for:
PHP код:
Hunting.inc
Mines
.inc
Missile
.inc
VehicleMissileCol
.inc 



Respuesta: 3DTryg Functions - MeScript2212 - 30.08.2017

Hi, very good include, thanks so much, i need it.
PD:Sorry for my bad english, am from Argentina.


Re: 3DTryg Functions - AbyssMorgan - 10.09.2017

Update v4.5.0:

- Added Vehicle Collision Module

- Added VehicleCollision Functions:
PHP код:
Tryg3D::InitVehicleCollision(); //Init VehicleCollision System
Tryg3D::ExitVehicleCollision();
Tryg3D::SyncVehicleCollision(vehicleid);
//force resync vehicle collision (call after new vehicle created or use OnVehicleCreated from EVF.inc)
//only if VehicleCollision is inited
//Collision detection
MovePointColWithVehicle(Float:StartX,Float:StartY,Float:StartZ,Float:EndX,Float:EndY,Float:EndZ,&Float:x,&Float:y,&Float:z);
//Detection type: Cube3D
//Return position type: Sphere
//Return value: vehicleid or INVALID_VEHICLE_ID 
- Added compiler option:
PHP код:
DISABLE_3D_TRYG_VEHICLECOL 
Screenshot:
https://i.imgur.com/vIYQPXC.png

Download:
3DTryg.inc


Re: 3DTryg Functions - AbyssMorgan - 19.09.2017

Update v4.5.1:

- Update ColAndreas detection for damaged colandreas.inc

- Fixed all wall collision detection

- Added Vehicle Collision Functions (Thanks Unrea1 for testing):
PHP код:
//check wall or vehicle collision
IsBetweenElementToPointIsVeh(Float:x,Float:y,Float:z,TRYG3D_ELEMENT_TAG targetid,Item3D_Type:target_type);
IsBetweenElementsIsVeh(TRYG3D_ELEMENT_TAG elementid,Item3D_Type:element_type,TRYG3D_ELEMENT_TAG targetid,Item3D_Type:target_type);
MovePointColWithVehicleCut(Float:StartX,Float:StartY,Float:StartZ,Float:EndX,Float:EndY,Float:EndZ,&Float:x,&Float:y,&Float:z,Float:cut_size=0.0); 
- Updated functions for VehicleCollision:
Код:
IsPointInSphericalSectorEx(Float:px,Float:py,Float:pz,Float:x,Float:y,Float:z,Float:rx,Float:rz,Float:radius,Float:vrx,Float:vrz,bool:testLOS=true,bool:veh_col=false);
IsElementOnPlayerScreen(playerid,targetid,Item3D_Type:target_type=item_player,element_orientation:orientation=o_front,Float:rx=INVALID_ROTATION,Float:rz=INVALID_ROTATION,Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true,bool:testVW=true,bool:veh_col=false);
IsElementOnFakeScreen(Float:x,Float:y,Float:z,targetid,Item3D_Type:target_type,Float:rx,Float:rz,Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true,bool:veh_col=false);
IsPlayerInRangeOfElement(playerid,Float:range,targetid,Item3D_Type:target_type=item_player,bool:testLOS=true,bool:veh_col=false);
IsElementInRangeOfPoint(Float:x,Float:y,Float:z,Float:range,targetid,Item3D_Type:target_type=item_player,bool:testLOS=true,bool:veh_col=false);
IsElementInRangeOfElement(elementid,Item3D_Type:element_type,Float:range,targetid,Item3D_Type:target_type=item_player,bool:testLOS=true,bool:veh_col=false);
Download:
3DTryg.inc


Re: 3DTryg Functions - Xeon™ - 19.09.2017

Nice work. that's much functions......


Re: 3DTryg Functions - Pottus - 19.09.2017

I would just like to mention I noticed something off.

Код:
	if(x == 0.0) x = EndX;
	if(y == 0.0) y = EndY;
	if(z == 0.0) z = EndZ;
When you use floats you should never use absolute precision since floats don't have absolute precision when making calculations.

You should always use less than/greater than operators when using floats never the equal to operator.

Код:
if(x > -0.0001 && x < 0.0001) x = EndX;



Re: 3DTryg Functions - Nero_3D - 20.09.2017

Quote:
Originally Posted by Pottus
Посмотреть сообщение
I would just like to mention I noticed something off.

Код:
	if(x == 0.0) x = EndX;
	if(y == 0.0) y = EndY;
	if(z == 0.0) z = EndZ;
When you use floats you should never use absolute precision since floats don't have absolute precision when making calculations.

You should always use less than/greater than operators when using floats never the equal to operator.

Код:
if(x > -0.0001 && x < 0.0001) x = EndX;
Well I think he wanted to check if CA_RayCastLine hit something so checking for 0.0 is fine because he set x, y, z to 0.0 beforehand, also 0.0 is a special value, so there won't be any rounding errors
Although the recommended way would be to use return value, wiki/ca_raycastline


Re: 3DTryg Functions - AbyssMorgan - 21.09.2017

Quote:
Originally Posted by Pottus
Посмотреть сообщение
I would just like to mention I noticed something off.

Код:
	if(x == 0.0) x = EndX;
	if(y == 0.0) y = EndY;
	if(z == 0.0) z = EndZ;
When you use floats you should never use absolute precision since floats don't have absolute precision when making calculations.

You should always use less than/greater than operators when using floats never the equal to operator.

Код:
if(x > -0.0001 && x < 0.0001) x = EndX;
PHP код:
Tryg3D::Function:: MovePointCol(Float:StartX,Float:StartY,Float:StartZ,Float:EndX,Float:EndY,Float:EndZ,&Float:x,&Float:y,&Float:z){
    
0.0//reset vars for RayCastLine and ignore old values
    
ColAndreas::RayCastLine(StartX,StartY,StartZ,EndX,EndY,EndZ,x,y,z); //save collision if exist in x,y,z
    
if(== 0.0EndX//collision not exist set End value
    
if(== 0.0EndY;
    if(
== 0.0EndZ;

The same in all MovePointCol functions:
MovePointCol.inc
MovePointColCutLine.inc
MovePointColCutLineEx.inc
MovePointColWithVehicle.inc


Re: 3DTryg Functions - CoaPsyFactor - 21.09.2017

Quote:
Originally Posted by Pottus
Посмотреть сообщение
I would just like to mention I noticed something off.

Код:
	if(x == 0.0) x = EndX;
	if(y == 0.0) y = EndY;
	if(z == 0.0) z = EndZ;
When you use floats you should never use absolute precision since floats don't have absolute precision when making calculations.

You should always use less than/greater than operators when using floats never the equal to operator.

Код:
if(x > -0.0001 && x < 0.0001) x = EndX;
so "1.0 - 1.0" is not absolute 0.0?


Re: 3DTryg Functions - AbyssMorgan - 28.09.2017

Update v4.5.2:

- Removed deprecated MapAndreas v1.1.0 support

- Update init system (more error detection, information)

- Minor code optimization

- Fix possibility double death in Tryg3D::GivePlayerDamage

- Removed Line3D Module

- Update ColAndreas / MapAndreas support

- Added FCNPC function (ColAndreas):
PHP код:
FCNPC::SetFloorPos(npcid); //fix z for current floor 
- Added Universal Functions (Streamer):
PHP код:
IsElementInDynamicArea(TRYG3D_ELEMENT_TAG elementid,Item3D_Type:element_type,STREAMER_TAG_AREA areaid);
GetElementsInDynamicArea(STREAMER_TAG_AREA areaid,Item3D_Type:element_type,element_list[],max_element=sizeof(element_list)); 
- Removed deprecated functions:
PHP код:
ConvertMTARaceRotation(Float:rotation1,Float:rotation2,Float:rotation3,&Float:rx,&Float:ry,&Float:rz);
ConvertToMTARaceRotation(Float:rx,Float:ry,Float:rz,&Float:rotation1,&Float:rotation2,&Float:rotation3); 
- Updated FCNPC function names (preserved old)
PHP код:
IsNPCInRangeOfPoint     -> FCNPC::InRangeOfPoint
GetNPCTargetAngle       
-> FCNPC::GetTargetAngle
SetNPCTargetAngle       
-> FCNPC::SetTargetAngle
GetNPCSpeed             
-> FCNPC::GetSpeed
GetPointInFrontOfNPC    
-> FCNPC::GetPointInFront
GetPointInFrontOfNPCCol 
-> FCNPC::GetPointInFrontCol
SetNPCAbsolutePosition  
-> FCNPC::SetAbsolutePosition 
- Renamed functions:
PHP код:
IsMapAndreasInit        -> Tryg3D::IsMapAndreasInit
SafeMapAndreasInit      
-> Tryg3D::SafeMapAndreasInit
IsColAndreasInit        
-> Tryg3D::IsColAndreasInit
SafeColAndreasInit      
-> Tryg3D::SafeColAndreasInit 
Download:
3DTryg.inc

Bugs Report


Re: 3DTryg Functions - Gammix - 28.09.2017

Bud, its time you break your code into parts. So many functions in one file, where you could make classes. Like if i only needed area check functions so i would just need to download the area file say try3d_area.inc.


Re: 3DTryg Functions - AbyssMorgan - 28.09.2017

Quote:
Originally Posted by Gammix
Посмотреть сообщение
Bud, its time you break your code into parts. So many functions in one file, where you could make classes. Like if i only needed area check functions so i would just need to download the area file say try3d_area.inc.
Modular Version here:
https://github.com/AbyssMorgan/3DTryg-Source

edit core.lst and create your own version.

Default 3DTryg only support option for disable/enable plugn/internal modules.


Re: 3DTryg Functions - ToiletDuck - 19.10.2017

IsPlayerOnPlayerScreen parameters? can't find it in the include.