SA-MP Forums Archive
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:CXFloat:CYFloat:CZ;
    new 
Float:CRZ;
    
GetVehiclePos(caridCXCYCZ);
    
GetVehicleZAngle(caridCRZ);
    
    
X-CX;
    
Y-CY;
    
Z-CZ;
    
    
X*floatcos(CRZdegrees)+Y*floatsin(CRZdegrees);
    
= -X*floatsin(CRZdegrees)+Y*floatcos(CRZdegrees);
    
    
RZ RZ-CRZ;