Editing attached objects on vehicles - 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: Editing attached objects on vehicles (
/showthread.php?tid=582657)
Editing attached objects on vehicles -
Glenn332 - 22.07.2015
So I am trying to edit an object on a vehicle which I attached by removing that object creating it again so I can move it around with EditObject(etc), but then I have to calculate what the pos is for AttachObjectToVehicle, So I got this but Its not working that well, the Z coords is ofcourse but the others once im finished editing they get like put back still the Z and one of the other is good but one coord is messing up and putting the object a little bit to the back of the vehicle, Anyone know why?
PHP код:
ObjectToCarPos(carid, &Float:X, &Float:Y, &Float:Z, &Float:RX, &Float:RY, &Float:RZ) {
new Float:CX, Float:CY, Float:CZ;
new Float:CRZ;
GetVehiclePos(carid, CX, CY, CZ);
GetVehicleZAngle(carid, CRZ);
X = X-CX;
Y = Y-CY;
Z = Z-CZ;
X = X*floatcos(CRZ, degrees)+Y*floatsin(CRZ, degrees);
Y = -X*floatsin(CRZ, degrees)+Y*floatcos(CRZ, degrees);
RZ = RZ-CRZ;
}