Advertisement
Guest User

Untitled

a guest
Oct 20th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. stock GetVehicleRelativePos(vehicleid, &Float:x, &Float:y, &Float:z, Float:xoff=0.0, Float:yoff=0.0, Float:zoff=0.0)
  2. {
  3. new Float:rot;
  4. GetVehicleZAngle(targetid, rot);
  5. rot = 360 - rot; // Making the vehicle rotation compatible with pawns sin/cos
  6. GetVehiclePos(vehicleid, x, y, z);
  7. x = floatsin(rot,degrees) * yoff + floatcos(rot,degrees) * xoff + x;
  8. y = floatcos(rot,degrees) * yoff - floatsin(rot,degrees) * xoff + y;
  9. z = zoff + z;
  10.  
  11. /*
  12. where xoff/yoff/zoff are the offsets relative to the vehicle
  13. x/y/z then are the coordinates of the point with the given offset to the vehicle
  14. xoff = 1.0 would e.g. point to the right side of the vehicle, -1.0 to the left, etc.
  15. */
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement