GetXYInFrontOfVehicle
#1

Hi,

I see mistake in this function or maybe there could be upgrade with z coordinate for ex:




I'am right what i make in picture? if you go with vehicle in mountain and i use this function XY in front on vehicle will be that red line? if yes how to upgrade this function calculating Z coordinate and make that what i make blue line

Same i think with GetXYInFrontOfPlayer
Reply
#2

Just get X and Y in front of player and then use MapAndreas plugin to get an accurate Z.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Just get X and Y in front of player and then use MapAndreas plugin to get an accurate Z.
NO!

Use this along with GetVehicleModelInfo (for vehicle size). This is easy, and if this issue is still open in a few hours I will post the code...
Reply
#4

It's possible to make something if player touching a vehicle any place end or side or towards
Reply
#5

Quote:
Originally Posted by ScIrUsna
Посмотреть сообщение
It's possible to make something if player touching a vehicle any place end or side or towards
What do you mean? Like say "/addarmourpanel" and place the panel relative to the vehicle, angles, side and so on?
Reply
#6

Quote:
Originally Posted by ScIrUsna
Посмотреть сообщение
It's possible to make something if player touching a vehicle any place end or side or towards
Not exactly, since we can't track the vehicle physical models that well.

You can check if a player is near a side of the AABB of the vehicle though, with the stuff I provided in my last comment.
Reply
#7

It's hard to understand how to use... Now i need to get position of tires,doors it's possible maybe in easier way?



Like here get tire position as red points marked then make a line like in picture and blue markers are cordinates if it reaching that red line that i need to excecute function it's possible to check? it's like making race line and you have just reach it.

Like here:

http://puu.sh/1UOPY
Reply
#8

Quote:
Originally Posted by ScIrUsna
Посмотреть сообщение
It's hard to understand how to use... Now i need to get position of tires,doors it's possible maybe in easier way?



Like here get tire position as red points marked then make a line like in picture and blue markers are cordinates if it reaching that red line that i need to excecute function it's possible to check? it's like making race line and you have just reach it.

Like here:

http://puu.sh/1UOPY
As I mentioned three times now, GetVehicleModelInfo. Look at the wiki for all of the things it can do.
Reply
#9

I use that function you give and i get position of tires, but now how use getvehiclemodelinfo?
Reply
#10

Quote:
Originally Posted by ScIrUsna
Посмотреть сообщение
I use that function you give and i get position of tires, but now how use getvehiclemodelinfo?
GetVehicleModelInfo is the function you used to get the offset of the tires. If you want to get the world position of the tires based on the vehicle's real position and rotation use the include I mentioned before, the vehicle matrix include.

Example, gets the real world position of all tires:
pawn Код:
#include a_samp
#include vehiclematrix

main() {
    new Float:offX, Float:offY, Float:offZ,
        Float:lPosX, Float:lPosY, Float:lPosZ,
        Float:rPosX, Float:rPosY, Float:rPosZ;
   
    new vehicleid = CreateVehicle(411, 0.0, 0.0, 3.0, 90.0, 0, 0, 10);
   
    GetVehicleModelInfo(411, VEHICLE_MODEL_INFO_WHEELSFRONT, offX, offY, offZ); // Returns offset of right front tire.
    PositionFromVehicleOffset(vehicleid, offX, offY, offZ, rPosX, rPosY, rPosZ); // Right is positive X offset.
    PositionFromVehicleOffset(vehicleid, -offX, offY, offZ, lPosX, lPosY, lPosZ); // Left is negative X offset.
   
    printf("Front Left : %3.2f, %3.2f, %3.2f | %3.2f, %3.2f, %3.2f", lPosX, lPosY, lPosZ, -offX, offY, offZ);
    printf("Front Right: %3.2f, %3.2f, %3.2f | %3.2f, %3.2f, %3.2f", rPosX, rPosY, rPosZ, offX, offY, offZ);
   
    GetVehicleModelInfo(411, VEHICLE_MODEL_INFO_WHEELSREAR, offX, offY, offZ); // Returns offset of right back tire.
    PositionFromVehicleOffset(vehicleid, offX, offY, offZ, rPosX, rPosY, rPosZ); // Right is positive X offset.
    PositionFromVehicleOffset(vehicleid, -offX, offY, offZ, lPosX, lPosY, lPosZ); // Left is negative X offset.
   
    printf("Back Left  : %3.2f, %3.2f, %3.2f | %3.2f, %3.2f, %3.2f", lPosX, lPosY, lPosZ, -offX, offY, offZ);
    printf("Back Right : %3.2f, %3.2f, %3.2f | %3.2f, %3.2f, %3.2f", rPosX, rPosY, rPosZ, offX, offY, offZ);
}
Reply
#11

Thanks . But i it's but with PositionFromVehicleOffset sometimes i get 0.0, i print ongamemodeinit i get right value, i make it in onplayerupdate not working Try do cikle MAX_VEHICLES and use this function
Reply
#12

Quote:
Originally Posted by ScIrUsna
View Post
Thanks . But i it's but with PositionFromVehicleOffset sometimes i get 0.0, i print ongamemodeinit i get right value, i make it in onplayerupdate not working Try do cikle MAX_VEHICLES and use this function
1st off, you shouldn't be using OnPlayerUpdate. It'll execute hundreds of times per second.

GetVehicleRotationQuats only updates the right values when the vehicle is streamed in for a player, that is the core of PositionFromVehicleOffset.
Reply
#13

But i use it on ongamemodeinit Max_vehicles i get right values how it's possible?
Reply
#14

Maybe possible other way do without use this matrix? i just need to know vehicle shape like isplayerinarea, four points

https://sampforum.blast.hk/showthread.php?tid=446286

It's like here billiard ball go to corner and he can't go out
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)