19.03.2013, 16:38
There is basic idea. Let's create SetVehiclePos which works with front bumper position, not center of vehicle (front wheels aren't good either). So I've begun
I'm testing with angle = 175, so the x coords are completely screwed up, but y work quite nicely. After commenting the x axis I got something like http://imgur.com/a/ZWTkv - damnit, packer is screwed up. It's longer in the back than in the front. Any idea how to fix this? (_not_ using front wheel position, as it won't be the same)
pawn Код:
SetVehicleFrontBumperPos(vid, Float:x, Float:y, Float:z, Float:angle) {
new
Float:sin = floatsin(-angle, degrees),
Float:cos = floatcos(angle, degrees),
model = GetVehicleModel(vid),
Float:fD[3];
GetVehicleModelInfo(model, VEHICLE_MODEL_INFO_SIZE, fD[0], fD[1], fD[2]);
//Let's get half of vehicle length
//x /= 2 won't work for floats
fD[0] = fD[0] / 2;
fD[1] = fD[1] / 2;
x -= (fD[0] * cos) - (fD[1] * sin);
y -= (fD[1] * cos) - (fD[0] * sin);
SetVehicleZAngle(vid, angle);
return SetVehiclePos(vid, x, y, z);
}