30.01.2013, 07:39
Trying to get the coordinates of all 4 tires on a vehicle..
That gets the FRONT LEFT one, but how about the others? I've tried countless things :/
I need to use VEHICLE_MODEL_INFO_WHEELSBACK to get the back ones, but firstly I need the front left one. I've tried 'reversing' the offset (if the offset is 0.7, change it to -0.7) but that doesn't work..
Any help appreciated, thanks.
pawn Code:
// Find the tirepos and creates an object there to see if it's right (it is)
new vehicleid = GetPlayerVehicleID(playerid);
new model = GetVehicleModel(vehicleid);
// Get vehicle position
new Float:x, Float:y, Float:z;
GetVehiclePos(vehicleid, x, y, z);
// Get vehicle angle
new Float:vehAngle;
GetVehicleZAngle(vehicleid, vehAngle);
// Get Offsets
new Float:wheelOffset[3];
GetVehicleModelInfo(model, VEHICLE_MODEL_INFO_WHEELSFRONT, wheelOffset[0], wheelOffset[1], wheelOffset[2]);
wheelOffset[0] += 0.7; // Bit further out on x axis, so it's not actually INSIDE the wheel (the object)
// This gets the FRONT RIGHT wheel. Find out how to get others
x += (floatcos(vehAngle, degrees) * wheelOffset[0]) - (floatsin(vehAngle, degrees) * wheelOffset[1]);
y += (floatsin(vehAngle, degrees) * wheelOffset[0]) + (floatcos(vehAngle, degrees) * wheelOffset[1]);
CreateDynamicObject(1238, x, y, z, 0, 0, 0);
I need to use VEHICLE_MODEL_INFO_WHEELSBACK to get the back ones, but firstly I need the front left one. I've tried 'reversing' the offset (if the offset is 0.7, change it to -0.7) but that doesn't work..
Any help appreciated, thanks.