Vehicle Offsets from Vehicle Position and Other Position - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Vehicle Offsets from Vehicle Position and Other Position (
/showthread.php?tid=502142)
Vehicle Offsets from Vehicle Position and Other Position -
RedFusion - 22.03.2014
How is this achieved?
Re: Vehicle Offsets from Vehicle Position and Other Position -
Kyle - 22.03.2014
Explain more..
Re: Vehicle Offsets from Vehicle Position and Other Position -
RedFusion - 22.03.2014
Example
pawn Код:
new vehicleid, Float:x, Float:y, Float:z, Float:angle;
vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid)
{
GetVehiclePos(vehicleid, x, y, z);
GetVehicleZAngle(vehicleid, angle);
AttachObjectToVehicle(objectid, vehicleid, fX - x, fY - y, fZ - z, 0.0, 0.0, angle);
}
else
{
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angle);
AttachObjectToPlayer(objectid, playerid, fX - x, fY - y, fZ - z, 0.0, 0.0, angle);
}
This only works when the player/vehicle has the angle 0.0, i would like this to work at every angle
(fX, fY, fZ is the position of the object)
Re: Vehicle Offsets from Vehicle Position and Other Position -
Kyle - 22.03.2014
Been asked a number of times. Not even the most advance scripters / math maniacs can do this.
Maybe Kalcor can add something to help us with this infuture to convert world angles to vehicle angles attachment angles.