SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 08/10/2015, 12:29 PM   #11
Crayder
Banned
 
Join Date: Sep 2013
Location: Flames of Hell
Posts: 3,331
Reputation: 652
Default Re: Get Point In Front 2D 3D

It's not anything to do with the terrain. It's all a point in space and angles from that point.
Quote:
Map of GTA is flat
Do not lecture.
You saying that just proved how much you know, not much at all!
Crayder is offline   Reply With Quote
Old 08/10/2015, 03:05 PM   #12
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,213
Reputation: 352
Default Re: Get Point In Front 2D 3D

Quote:
Originally Posted by Crayder View Post
It's not anything to do with the terrain. It's all a point in space and angles from that point.You saying that just proved how much you know, not much at all!
I know that I have to give rotations RX and RZ, and not some length
AbyssMorgan is offline   Reply With Quote
Old 08/10/2015, 04:55 PM   #13
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,213
Reputation: 352
Default Re: Get Point In Front 2D 3D

I added two new function:
PHP Code:
GetRotationFor2Point2D(Float:xFloat:yFloat:txFloat:ty, &Float:rz); //made by Zoutdaxv (modified version)
GetRotationFor2Point3D(Float:xFloat:yFloat:zFloat:txFloat:tyFloat:tz, &Float:rx, &Float:rz); //new code version support 3D made by Abyss Morgan 
AbyssMorgan is offline   Reply With Quote
Old 08/10/2015, 04:59 PM   #14
Crayder
Banned
 
Join Date: Sep 2013
Location: Flames of Hell
Posts: 3,331
Reputation: 652
Default Re: Get Point In Front 2D 3D

Quote:
Originally Posted by AbyssMorgan View Post
I know that I have to give rotations RX and RZ, and not some length
Latitude and longitude are not lengths. They are rotations. We've been over this already.
Crayder is offline   Reply With Quote
Old 08/10/2015, 05:01 PM   #15
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,213
Reputation: 352
Default Re: Get Point In Front 2D 3D

Quote:
Originally Posted by Crayder View Post
Latitude and longitude are not lengths. They are rotations. We've been over this already.
not important, it gives the parameters that will understand every person, not just you
AbyssMorgan is offline   Reply With Quote
Old 08/10/2015, 05:26 PM   #16
Crayder
Banned
 
Join Date: Sep 2013
Location: Flames of Hell
Posts: 3,331
Reputation: 652
Default Re: Get Point In Front 2D 3D

Quote:
Originally Posted by AbyssMorgan View Post
not important, it gives the parameters that will understand every person, not just you
You are the only person here that doesn't know what latitude and longitude is.

Also:
pawn Code:
stock CompRotationFloat(Float:rotation,&Float:cr){
    cr = rotation;
    while(cr < 0.0) cr += 360.0;
    while(cr >= 360.0) cr -= 360.0;
}
Use a while loop. One single subtraction or addition could return adverse numbers. Using a while loop will make sure the number is more than 0 and less than 360 no matter what the input is.
Crayder is offline   Reply With Quote
Old 08/10/2015, 05:29 PM   #17
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,213
Reputation: 352
Default Re: Get Point In Front 2D 3D

Quote:
Originally Posted by Crayder View Post
Also:
pawn Code:
stock CompRotationFloat(Float:rotation,&Float:cr){
    cr = rotation;
    while(cr < 0.0) cr += 360.0;
    while(cr >= 360.0) cr -= 360.0;
}
Use a while loop. One single subtraction or addition could return adverse numbers. Using a while loop will make sure the number is more than 0 and less than 360 no matter what the input is.
OK
//edit I made a test and froze while server
I'm going back to my function

Last edited by AbyssMorgan; 08/10/2015 at 09:12 PM.
AbyssMorgan is offline   Reply With Quote
Old 08/10/2015, 11:36 PM   #18
Crayder
Banned
 
Join Date: Sep 2013
Location: Flames of Hell
Posts: 3,331
Reputation: 652
Default Re: Get Point In Front 2D 3D

Quote:
Originally Posted by AbyssMorgan View Post
OK
//edit I made a test and froze while server
I'm going back to my function
Your code is wrong, a single addition/subtraction will not work. For example, 730 in your code would return 370. My while loops will return 10.

If a test froze your server it is all on your end, it works perfectly fine for me.
Crayder is offline   Reply With Quote
Old 09/10/2015, 04:38 PM   #19
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,213
Reputation: 352
Default Re: Get Point In Front 2D 3D

Quote:
Originally Posted by Crayder View Post
Your code is wrong, a single addition/subtraction will not work. For example, 730 in your code would return 370. My while loops will return 10.

If a test froze your server it is all on your end, it works perfectly fine for me.

accidentally I made a mistake in my alternative
PHP Code:
stock CompRotation(rotation,&cr){ 
    
cr rotation
    while(
cr 0.0cr += 360.0;        //shit
    
while(cr >= 360.0cr -= 360.0;    //shit

The loop works
PHP Code:
stock CompRotation(rotation,&cr){ 
    
cr rotation
    while(
cr 0cr += 360
    while(
cr >= 360cr -= 360
}

stock CompRotationFloat(Float:rotation,&Float:cr){ 
    
cr rotation
    while(
cr 0.0cr += 360.0
    while(
cr >= 360.0cr -= 360.0

AbyssMorgan is offline   Reply With Quote
Old 28/10/2015, 06:16 PM   #20
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,213
Reputation: 352
Default Re: Get Point In Front 2D 3D

added new function:
PHP Code:
ShiftDegreeToRadian(Float:deg,&Float:rad);
ShiftDegreeToGrades(Float:deg,&Float:grad);
ShiftRadianToDegree(Float:rad,&Float:deg);
ShiftRadianToGrades(Float:rad,&Float:grad);
ShiftGradesToDegree(Float:grad,&Float:deg);
ShiftGradesToRadian(Float:grad,&Float:rad);
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); 
Download Full Include from GitHub
AbyssMorgan is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] [INC] LSF - Lorenc's Simple Functions (w/ gang/clan functions) Lorenc_ Includes 14 21/04/2018 05:06 AM
What is the difference between public functions and stock functions? NeskWriter Scripting Help 1 16/10/2013 07:23 PM
File Functions + String Functions NoaM[W] Scripting Help 2 19/12/2012 09:13 PM
Pawno functions Doesn't Show on the functions Tab silvan Scripting Help 2 11/11/2012 10:42 AM
[Tool/Web/Other] Cross Functions V1.0 - Create Custom Call Backs / Functions by Just 1 Click CROSS_Hunter Tools and Files 7 05/11/2012 03:17 PM


All times are GMT. The time now is 05:23 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.