SA-MP Forums [Include] 3DTryg Functions
 New Account Members List Search Today's Posts Mark Forums Read

 19/09/2017, 10:10 PM #141 Pottus High-roller     Join Date: Jun 2012 Posts: 4,899 Reputation: 1321 Re: 3DTryg Functions I would just like to mention I noticed something off. Code: ``` 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. Code: `if(x > -0.0001 && x < 0.0001) x = EndX;`
20/09/2017, 02:41 AM   #142
Nero_3D
High-roller

Join Date: Jun 2007
Location: Germany
Posts: 2,836
Reputation: 671
Re: 3DTryg Functions

Quote:
 Originally Posted by Pottus I would just like to mention I noticed something off. Code: ``` 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. Code: `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

21/09/2017, 08:04 AM   #143
AbyssMorgan
Banned

Join Date: Apr 2015
Location: Poland
Posts: 1,212
Reputation: 352
Re: 3DTryg Functions

Quote:
 Originally Posted by Pottus I would just like to mention I noticed something off. Code: ``` 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. Code: `if(x > -0.0001 && x < 0.0001) x = EndX;`

PHP Code:
``` Tryg3D::Function:: MovePointCol(Float:StartX,Float:StartY,Float:StartZ,Float:EndX,Float:EndY,Float:EndZ,&Float:x,&Float:y,&Float:z){     x = y = 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(x == 0.0) x = EndX; //collision not exist set End value     if(y == 0.0) y = EndY;     if(z == 0.0) z = EndZ; }  ```
The same in all MovePointCol functions:
MovePointCol.inc
MovePointColCutLine.inc
MovePointColCutLineEx.inc
MovePointColWithVehicle.inc

21/09/2017, 08:25 PM   #144
CoaPsyFactor
Gangsta

Join Date: Jul 2010
Posts: 866
Reputation: 52
Re: 3DTryg Functions

Quote:
 Originally Posted by Pottus I would just like to mention I noticed something off. Code: ``` 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. Code: `if(x > -0.0001 && x < 0.0001) x = EndX;`
so "1.0 - 1.0" is not absolute 0.0?
__________________
Quote:
 Originally Posted by ThaiLuan Code: ```C:\Users\Administrator\Downloads\Viet-RP\gamemodes\3mien.pwn(112016) : fatal error 101: cannot write to file: "disk full" Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase 1 Error.``` Help me! How to fix error

 28/09/2017, 09:29 AM #145 AbyssMorgan Banned   Join Date: Apr 2015 Location: Poland Posts: 1,212 Reputation: 352 Re: 3DTryg Functions 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 Code: ``` FCNPC::SetFloorPos(npcid); //fix z for current floor  ``` - Added Universal Functions (Streamer): PHP Code: ``` 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 Code: ``` 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 Code: ``` IsNPCInRangeOfPoint     -> FCNPC::InRangeOfPoint GetNPCTargetAngle       -> FCNPC::GetTargetAngle SetNPCTargetAngle       -> FCNPC::SetTargetAngle GetNPCSpeed             -> FCNPC::GetSpeed GetPointInFrontOfNPC    -> FCNPC::GetPointInFront GetPointInFrontOfNPCCol -> FCNPC::GetPointInFrontCol SetNPCAbsolutePosition  -> FCNPC::SetAbsolutePosition  ``` - Renamed functions: PHP Code: ``` IsMapAndreasInit        -> Tryg3D::IsMapAndreasInit SafeMapAndreasInit      -> Tryg3D::SafeMapAndreasInit IsColAndreasInit        -> Tryg3D::IsColAndreasInit SafeColAndreasInit      -> Tryg3D::SafeColAndreasInit  ``` Download: 3DTryg.inc Bugs Report
 28/09/2017, 03:44 PM #146 Gammix High-roller     Join Date: Jan 2015 Location: Canada Posts: 1,770 Reputation: 849 Re: 3DTryg Functions 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.
28/09/2017, 03:51 PM   #147
AbyssMorgan
Banned

Join Date: Apr 2015
Location: Poland
Posts: 1,212
Reputation: 352
Re: 3DTryg Functions

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.

 19/10/2017, 05:00 AM #148 ToiletDuck Huge Clucker     Join Date: Apr 2012 Location: Philippines, Lucena City Posts: 398 Reputation: 43 Re: 3DTryg Functions IsPlayerOnPlayerScreen parameters? can't find it in the include.
19/10/2017, 06:50 AM   #149
AbyssMorgan
Banned

Join Date: Apr 2015
Location: Poland
Posts: 1,212
Reputation: 352
Re: 3DTryg Functions

Quote:
 Originally Posted by ToiletDuck IsPlayerOnPlayerScreen parameters? can't find it in the include.
Deprecated, use:
PHP Code:
``` 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);  ```

 04/12/2017, 06:30 PM #150 kennydalglish Big Clucker   Join Date: Dec 2014 Posts: 157 Reputation: 8 Re: 3DTryg Functions Hi. I'm trying to make sure that if a player walks out of the range, he drops it at a distance. With repeated use, the player can still exit the polygon. (tk tshshit not purely back, and still to the right). How can you solve this issue? PHP Code: ``` new Float: x_pos,     Float: y_pos,     Float: z_pos,     Float: angle,     Float: new_x_pos,     Float: new_y_pos,     Float: new_z_pos; GetPlayerPos(playerid, x_pos, y_pos, z_pos); GetPointInFront3D(x_pos, y_pos, z_pos, 0.0, 0.0, -7.5, new_x_pos, new_y_pos, new_z_pos);   SetPlayerPos(playerid, new_x_pos, new_y_pos, new_z_pos);  ```

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Lorenc_ Includes 14 21/04/2018 05:06 AM NeskWriter Scripting Help 1 16/10/2013 07:23 PM NoaM[W] Scripting Help 2 19/12/2012 09:13 PM silvan Scripting Help 2 11/11/2012 10:42 AM CROSS_Hunter Tools and Files 7 05/11/2012 03:17 PM

All times are GMT. The time now is 09:24 AM.

 -- (EN) English -- (RU) Русски SA-MP - Archive - Top