GetVehicleRotationQuat always returning {0.5, 0.5, 0.5, 0.5} after spawning
#6

I ended up not using the math plugin due to this issue. the rotationquat doesn't seem to update while no player is inside the vehicle.

Here is my resulting method if anyone cares:
Код:
stock IsPlayerAtVehicleTrunk(playerid, vehicleid)
{
	new Float:sizex, Float:sizey, Float:unused, Float:bumperz, 
	Float:posx, Float:posy, Float:posz, Float:posa;

	//Get all required data
	GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, sizex, sizey, unused);
	GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_REAR_BUMPER_Z, unused, unused, bumperz);
 	GetVehiclePos(vehicleid, posx, posy, posz); 
 	GetVehicleZAngle(vehicleid, posa);

 	//A check to determine if the player is actually near the vehicle. 
 	//If the player is not near the vehicle we can stop this script from doing more 'complex' calculations.
	if(!IsPlayerInRangeOfPoint(playerid, sizey, posx, posy, posz))
		return 0;

	//Calculate trunk position
	posx += (sizey / 2) * floatsin(-posa + 180, degrees);
	posy += (sizey / 2) * floatcos(-posa + 180, degrees);
	posz += bumperz;

	return IsPlayerInRangeOfPoint(playerid, sizex / 2, posx, posy, posz);
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)