How to get position just behind car. -
MA_proking - 04.08.2014
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.
Re: How to get position just behind car. - Diti1 - 04.08.2014
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
Re: How to get position just behind car. -
MA_proking - 04.08.2014
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.
Re: How to get position just behind car. -
Stanford - 04.08.2014
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.
AW: How to get position just behind car. -
Nero_3D - 04.08.2014
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));
}
Re: How to get position just behind car. -
Mauzen - 04.08.2014
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
Re: How to get position just behind car. -
MA_proking - 04.08.2014
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]