How to get position just behind car.
#1



I need help Please.
I need X,Y and Z.
I have X Y Z of green Car
Assume that coordinate for green car is X1, Y1 and Z1
So what will the possible coordinates of Brown car.
Reply
#2

hmm use debug type /vsel and press at sultan then park it use /save greencar after do again /vsel choose sultan then park behind greencar /save browncar after go at documents Gta then SAMP >>>Savepositions and copy the coordinations and done if you mean for this
Reply
#3

Quote:
Originally Posted by Diti1
Посмотреть сообщение
hmm use debug type /vsel and press at sultan then park it use /save greencar after do again /vsel choose sultan then park behind greencar /save browncar after go at documents Gta then SAMP >>>Savepositions and copy the coordinations and done if you mean for this
I need it dynamically.
Reply
#4

Create a command with sscanf (something like createcarnearcar [carid]) and after checking if the carid given is exist, get the vehicle position of that carid and use CreateVehicle, decrease the Y by 3 (Y-3) or more if needed and it should work fine.
Reply
#5

Use that with a negative distance and the z angle of the vehicle
Or add / subtract 180 degrees to the angle and use a positive distance
pawn Код:
stock GetXYFromAngle(Float: angle, Float:distance, & Float: x, & Float: y) {
    x -= (distance * floatsin(angle, degrees));
    y += (distance * floatcos(angle, degrees));
}
Reply
#6

Thats trigonometry. Im not sure about the exact angles as SA-MP angles always behave strange.

pawn Код:
//new Float:x, Float:y, Float:z, Float:rot;    // is Vehicle 1 position and rotation
new Float:cx, Float:cy, Float:cz; // is Vehicle 2 position
cx = x + floatsin(360.0 - (rot + 180.0), degrees) * distance_between_vehicles;    // "360.0 -" is to transform the samp angle to the mathematical one
cy = y + floatcos(360.0 - (rot + 180.0), degrees) * distance_between_vehicles;  //  "+ 180.0" is to point behind the other vehicle, else it would spawn in front of it
Thats a pretty common question, you could have searched
Reply
#7

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
Thats trigonometry. Im not sure about the exact angles as SA-MP angles always behave strange.

pawn Код:
//new Float:x, Float:y, Float:z, Float:rot;    // is Vehicle 1 position and rotation
new Float:cx, Float:cy, Float:cz; // is Vehicle 2 position
cx = x + floatsin(360.0 - (rot + 180.0), degrees) * distance_between_vehicles;    // "360.0 -" is to transform the samp angle to the mathematical one
cy = y + floatcos(360.0 - (rot + 180.0), degrees) * distance_between_vehicles;  //  "+ 180.0" is to point behind the other vehicle, else it would spawn in front of it
Thats a pretty common question, you could have searched
Thanks

You earned my respect sir. [Not Forum Respect]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)