GetXYZInFrontOfVehicle ? -
NopeNope - 01.05.2014
How i can do this? Thank you for response.
Re: GetXYZInFrontOfVehicle ? -
JacobEdwards - 01.05.2014
Here is the code for GetXYInFrontOfVehicle()
pawn Код:
GetXYInFrontOfVehicle(playerid, &Float:x, &Float:y, Float:distance)
{
new Float:a;
GetVehiclePos(playerid, x, y, a);
GetVehicleZAngle(playerid, a);
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
}
Re: GetXYZInFrontOfVehicle ? -
NopeNope - 01.05.2014
Quote:
Originally Posted by JacobEdwards
Here is the code for GetXYInFrontOfVehicle()
pawn Код:
GetXYInFrontOfVehicle(playerid, &Float:x, &Float:y, Float:distance) { new Float:a; GetVehiclePos(playerid, x, y, a); GetVehicleZAngle(playerid, a); x += (distance * floatsin(-a, degrees)); y += (distance * floatcos(-a, degrees)); }
|
Yeah, but i need Z-axis.
I have this code:
http://pastebin.com/uDz10QEQ
But this doesnt' work properly, the checkpoint don't appears sometimes.
Sorry for my bad english
Re: GetXYZInFrontOfVehicle ? -
Konstantinos - 01.05.2014
You need the z (height) and that can be found by GetVehiclePos function. I added + 1 to the current height just to prevent it to be underground. If it's over the ground though, you can remove it.
pawn Код:
GetXYZInFrontOfVehicle(vehicleid, &Float:x, &Float:y, &Float:z, Float:distance)
{
new Float:a;
GetVehiclePos(playerid, x, y, z);
GetVehicleZAngle(playerid, a);
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
z += 1.0;
}
You don't need the rotations of the vehicle.
Re: GetXYZInFrontOfVehicle ? -
NopeNope - 01.05.2014
Okay, thank you.
But i have a problem, when i enter in a car and i rotate it, the checkpoint appears in another position.
Re: GetXYZInFrontOfVehicle ? -
Konstantinos - 01.05.2014
Do you create the checkpoint after entering the car or before?
Re: GetXYZInFrontOfVehicle ? -
NopeNope - 01.05.2014
** Sorry for doublepost **
Screens:
http://gyazo.com/6602bab02a4ea2529a7fff8a2f61be20
http://gyazo.com/8229ebde61ad210b64bbbe0cf6c3845b
http://gyazo.com/80b918f71500ba026de660e2b8c983c2
EDIT: I create the checkpoint when im in a house (interior).
Re: GetXYZInFrontOfVehicle ? -
Konstantinos - 01.05.2014
So you're not in the car. I'm not sure but I think there's a bug with SetVehicleZAngle function and it won't set the angle if the vehicle is not occupied. So it might return the previous angle and that's why it doesn't create it in front of it.
Re: GetXYZInFrontOfVehicle ? -
NopeNope - 01.05.2014
Quote:
Originally Posted by JacobEdwards
Here is the code for GetXYInFrontOfVehicle()
pawn Код:
GetXYInFrontOfVehicle(playerid, &Float:x, &Float:y, Float:distance) { new Float:a; GetVehiclePos(playerid, x, y, a); GetVehicleZAngle(playerid, a); x += (distance * floatsin(-a, degrees)); y += (distance * floatcos(-a, degrees)); }
|
Quote:
Originally Posted by Konstantinos
So you're not in the car. I'm not sure but I think there's a bug with SetVehicleZAngle function and it won't set the angle if the vehicle is not occupied. So it might return the previous angle and that's why it doesn't create it in front of it.
|
So? I can't? I must create the checkpoint behind the car but the coord are wrong. I don't know how to do...
Re: GetXYZInFrontOfVehicle ? -
CoaPsyFactor - 01.05.2014
Quote:
Originally Posted by Konstantinos
You need the z (height) and that can be found by GetVehiclePos function. I added + 1 to the current height just to prevent it to be underground. If it's over the ground though, you can remove it.
pawn Код:
GetXYZInFrontOfVehicle(vehicleid, &Float:x, &Float:y, &Float:z, Float:distance) { new Float:a; GetVehiclePos(playerid, x, y, z); GetVehicleZAngle(playerid, a); x += (distance * floatsin(-a, degrees)); y += (distance * floatcos(-a, degrees)); z += 1.0; }
You don't need the rotations of the vehicle.
|
You serious? All you've done is adding +1 to Z coord, that is not correct way to do it xD