22.06.2016, 11:13
Well, today i'am trying to make something to attach a object to a vehicle, without using AttachObjectToVehicle, i mean i create a dynamic object and i create a vehicle i want to use EditDynamicObject to adjust the right position in the vehicle, when i confirm, the object will be attached, i believe that have a kind of maths but i'am not sure about my informations, so i try that :
But the position is still wrong i don't know why, when i make my object in the back of the vehicle, the object will be attached in the front, i need to get the correct way to calcul that.
PHP код:
// OnPlayerEditDynamicObject
if(pInfo[playerid][pVehicleAttachEdit] != -1) {
new id = pInfo[playerid][pVehicleAttachEdit],
Float:vehx, Float:vehy, Float:vehz;
GetVehiclePos(id, vehx,vehy,vehz);
VehicleData[id][VehAttachX] = x-vehx;
VehicleData[id][VehAttachY] = y-vehy;
VehicleData[id][VehAttachZ] = z-vehz;
VehicleData[id][VehAttachRX] = rx;
VehicleData[id][VehAttachRY] = ry;
VehicleData[id][VehAttachRZ] = rz;
ModVehicle(id);
SaveVehicle(id);
pInfo[playerid][pVehicleAttachEdit] = -1;
}