[Include] Rotations.inc
#19

Hey. I tried to make the function of tilting through the timer, but it still does not work correctly. Can you help me?
PHP код:
SetPlayerTimerEx(playerid"@@CheckPlayerInPolygons"250, -1,  "d"playerid); 
PHP код:
@@CheckPlayerInPolygons(const playerid);
@@
CheckPlayerInPolygons(const playerid)
{
    new 
Floatx_pos,
        
Floaty_pos,
        
Floatz_pos;
    
GetPlayerPos(playeridx_posy_posz_pos);
    if(!
IsPointInPolygon(x_posy_pos,     {                        42.0,2336.0,
        -
1327.0,2601.0,
        -
1349.0,2675.0,
        -
1397.0,2712.0,
        -
1435.0,2728.0,
        -
1501.0,2737.0,
        -
1560.0,2740.0,
        -
1627.0,2734.0,
        -
1653.0,2718.0,
        -
1639.0,2654.0,
        -
1610.0,2604.0,
        -
1604.0,2547.0,
        -
1596.0,2499.0,
        -
1474.0,2486.0,
        -
1406.0,2521.0,
        -
1337.0,2523.0,
        -
1327.0,2601.0}))
    {
        new 
FloatXFloatYFloatZ;
        
GetPlayerPos(playeridXYZ);
        new 
FloatrZ// the only angle you can get is rZ
        
GetPlayerFacingAngle(playeridrZ); // use 0.0 for rX and rY
        // oX (right vector offset) = 0.0, oY (front vector offset) = 5.0, oZ (up vector offset) = 0.0
        
EulerRotate(0.00.0rZ0.0, -5.00.0XYZ);
        
// X, Y, Z should now be 5 units before the player
        
SetPlayerPos(playeridXYZ);      
    }

Anyway, you can go beyond the polygon

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
Well, it is a bug in your code, no clue how you use GetXYInFrontOfPlayer to determine if the player is outside or not but the correct solution for your problem would be to check if the player is inside a polygon
Refer to IsPlayerInPolygon, it can be found in 3DTryg, it is based on ray-casting (wiki)
Still remember that RyDeR`posted the function and ****** said, it has been here for years XD
Reply


Messages In This Thread
Rotations.inc - by Nero_3D - 14.08.2016, 01:19
Re: Rotations.inc - by PT - 14.08.2016, 11:11
Re: Rotations.inc - by Sanady - 15.08.2016, 01:37
Re: Rotations.inc - by Nero_3D - 06.01.2017, 23:59
Re: Rotations.inc - by Crayder - 06.02.2017, 18:25
Re: Rotations.inc - by Nero_3D - 10.02.2017, 13:37
Re: Rotations.inc - by Crayder - 10.02.2017, 17:09
Re: Rotations.inc - by AbyssMorgan - 10.02.2017, 17:13
Re: Rotations.inc - by ball - 16.06.2017, 16:44
Re: Rotations.inc - by Nero_3D - 16.06.2017, 21:43
Re: Rotations.inc - by Nero_3D - 11.08.2017, 20:03
Re: Rotations.inc - by Admigo - 03.12.2017, 13:28
Re: Rotations.inc - by Nero_3D - 04.12.2017, 02:29
Re: Rotations.inc - by kennydalglish - 04.12.2017, 06:27
Re: Rotations.inc - by AbyssMorgan - 04.12.2017, 08:04
Re: Rotations.inc - by Nero_3D - 04.12.2017, 23:01
Re: Rotations.inc - by kennydalglish - 05.12.2017, 15:54
Re: Rotations.inc - by Nero_3D - 06.12.2017, 00:22
Re: Rotations.inc - by kennydalglish - 08.12.2017, 21:47
Re: Rotations.inc - by NaS - 08.03.2018, 15:02
Re: Rotations.inc - by Nero_3D - 16.03.2019, 21:26

Forum Jump:


Users browsing this thread: 2 Guest(s)