How do I calculate the GTA cords from objects/car offsets?
#1

How do I calculate the GTA cords from objects/car offsets?

For example how do I calculate the GTA cords from this offset: 1.051757,-2.713012,-0.012840 if the cars GTA cords are: -1377.2820,-256.9163,14.0373,328.7105

I have tried something like this:
x += (tmpX * floatsin(-angle, degrees));
x += (tmpX * floatcos(-angle, degrees));
y += (tmpY * floatsin(-angle, degrees));
y += (tmpY * floatcos(-angle, degrees));

But it didn't work.
Reply
#2

pawn Код:
new Float:voPos[ 3 ], Float:wPos[ 3 ];
GetVehicle/ObjectPos( vehicle/objectid, voPos[ 0 ], voPos[ 1 ], voPos[ 2 ] );
wPos[ 0 ] = voPos[ 0 ] + oX; // OffsetX
wPos[ 1 ] = voPos[ 1 ] + oY; // OffsetY
wPos[ 2 ] = voPos[ 2 ] + oY; // OffsetZ

// Final Position: wPos[ 0 ], wPos[ 1 ], wPos[ 2 ]
Reply
#3

IstuntmanI: thank you but I'm already doing this and it's only working when the angel is 0. If the angel is not 0 but instead like my example 328.7105 it will not work.
Reply
#4

It has nothing to do with the angle. I guess you are trying to create an object/vehicle at that position ? Try also getting the object/vehicle's angle and use it.
Reply
#5

It have to do with the angel I get the offsets from "public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)" with do not compensate for object or vehicle angels.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)