Calculating xangle? (rotx) ? -
Kar - 23.08.2011
pawn Code:
stock GetXYInFrontOfVehicle(vehicleid, &Float:x, &Float:y, [b]Float:xangle[/b], Float:distance)
{
new Float:a;
GetVehiclePos(vehicleid, x, y, a);
GetVehicleZAngle(vehicleid, a);
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
}
does anyone know how to add a xrotation calculation to this>?
Re: Calculating xangle? (rotx) ? -
Backwardsman97 - 23.08.2011
What do you mean xangle?
Re: Calculating xangle? (rotx) ? -
Kar - 23.08.2011
like this
http://forum.sa-mp.com/showthread.ph...ehiclerotation
Danger's one
xangle = heading / sideways
zangle = facing angle / bank
get what I mean?
now i got the xangle, but now I need to calculate infront of the vehicle with xangle..
xangle =
Re: Calculating xangle? (rotx) ? -
Kar - 24.08.2011
bumpt.. been 24 hours ^^
Re: Calculating xangle? (rotx) ? -
Kar - 26.08.2011
I must bump <.<
Re: Calculating xangle? (rotx) ? -
Babul - 26.08.2011
may i ask what you intend to do? like an artillery rocket aiming, while standing on the ground? or something like in a plane? if your vehicle (tank, artillery) stands on grond, it is possible maybe to do that without using the (bugged) quaternion formulas. its just 2 axis (x/z) used for an "aditional x" you requested, so i look forward to get some1 to work on this aswell :P
Re: Calculating xangle? (rotx) ? -
Lorenc_ - 26.08.2011
This'll be a epic thing I must know, bump!
Re: Calculating xangle? (rotx) ? -
Pinguinn - 26.08.2011
You also need the z-coordinate I think
AW: Calculating xangle? (rotx) ? -
Nero_3D - 26.08.2011
pawn Code:
stock RotatePoint(& Float: X, & Float: Y, & Float: Z, Float: pitch, Float: yaw, Float: distance) {
X -= (distance * floatcos(pitch, degrees) * floatsin(yaw, degrees));
Y += (distance * floatcos(pitch, degrees) * floatcos(yaw, degrees));
Z += (distance * floatsin(pitch, degrees));
}
pawn Code:
stock GetXYZOfVehicle(vehicleid, & Float: X, & Float: Y, & Float: Z, Float: pitch, Float: distance) {
static
Float: yaw;
if(GetVehicleZAngle(vehicleid, yaw)) {
GetVehiclePos(vehicleid, X, Y, Z);
RotatePoint(X, Y, Z, pitch, yaw, distance);
return true;
}
return false;
}
Re: Calculating xangle? (rotx) ? -
Kar - 28.08.2011
ok, I changed my code
pawn Code:
//new Float:x2 = x + (120 * floatsin(-(a + 90), degrees));
//new Float:y2 = y + (120 * floatcos(-(a + 90), degrees));
to
pawn Code:
new Float:x2, Float:y2, Float:z2, Float:heading, Float:attitude, Float:bank;
GetVehicleRotation(id, heading, attitude, bank);
GetXYZOfVehicle(id, x2, y2, z2, heading/*pitch*/, 120.0);
#pragma unused z2
#pragma unused attitude
#pragma unused bank
yet it doesn't work, I can't exactly tell what's happening. as soon as I shoot my missile exploded, it did no explode instantly with my previous code.. and I have a check to see if it's your vehicle the missile shot from it should not even check that vehicle..
I'll try to figure out where the missile comes out from this time
Edit: ok one, it doesn't work
two, if your turned around, at around 160 - 200 z angle, it fires out behind lol, it worked infront with the previous code
AW: Re: Calculating xangle? (rotx) ? -
Nero_3D - 28.08.2011
Ding, wrong variable
heading is the ZAngle (Yaw)
attitude is the Roll Angle
bank is the Pitch Angle
And than you forgot GetVehiclePos
Here your wanted code
pawn Code:
new Float:x2, Float:y2, Float:z2, Float:bank;
GetVehicleRotation(id, x2, y2, bank);
GetVehiclePos(id, x2, y2, z2); // dont change the order!
GetXYZOfVehicle(id, x2, y2, z2, bank, 120.0);
Re: Calculating xangle? (rotx) ? -
Kar - 28.08.2011
okay thanks, now it shoots fine. but the missile still doesn't go where the vehicle x angle / z is looking at (the hood of the car) I will pm you the code