25.01.2011, 08:53
Hello,
I searched the forum found a colleague Br also had a question similar to mine but I guess it did not clarify the question so I'll try here.
Anyone here who knows about Trig, I'm terrible for days tried to make the calculation more unsuccessfully, I need to get the X, Y position of a vehicle as the angle for example:
Take the exact location of where the door is right next vehicle model: 409, depending on the angle.
I even tried to reverse engineer (: P) that function to try to understand the calculation but rather a complete failure, if somebody can give me the light.
[pawn]
Stock GetXYInFrontOfPlayer (playerid, distance, & Float: x, & Float: y, & Float: Z, & Float: a)
{
GetPlayerPos (playerid, x, y, z);
GetPlayerFacingAngle (playerid, a);
if (IsPlayerInAnyVehicle (playerid))
{
GetVehiclePos (GetPlayerVehicleID (playerid), x, y, z);
GetVehicleZAngle (GetPlayerVehicleID (playerid), a);
}
x + = (distance * floatsin (-a, degrees));
y + = (distance * floatcos (-a, degrees));
}
[/ pawn]
Just do not tell me to recommend sites of its kind of fundamental mathematics.
Just post the function or try to explain how it works
All help is welcome. Thanks.
Sorry bad English.
I searched the forum found a colleague Br also had a question similar to mine but I guess it did not clarify the question so I'll try here.
Anyone here who knows about Trig, I'm terrible for days tried to make the calculation more unsuccessfully, I need to get the X, Y position of a vehicle as the angle for example:
Take the exact location of where the door is right next vehicle model: 409, depending on the angle.
I even tried to reverse engineer (: P) that function to try to understand the calculation but rather a complete failure, if somebody can give me the light.
[pawn]
Stock GetXYInFrontOfPlayer (playerid, distance, & Float: x, & Float: y, & Float: Z, & Float: a)
{
GetPlayerPos (playerid, x, y, z);
GetPlayerFacingAngle (playerid, a);
if (IsPlayerInAnyVehicle (playerid))
{
GetVehiclePos (GetPlayerVehicleID (playerid), x, y, z);
GetVehicleZAngle (GetPlayerVehicleID (playerid), a);
}
x + = (distance * floatsin (-a, degrees));
y + = (distance * floatcos (-a, degrees));
}
[/ pawn]
Just do not tell me to recommend sites of its kind of fundamental mathematics.
Just post the function or try to explain how it works
All help is welcome. Thanks.
Sorry bad English.