22.07.2015, 11:54
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;
}