GetXYInAngleOfPlayer ?
#2

I made this ages ago: http://pastebin.com/1hLSAVJu

Usage is inside.

Examples:

There are two ways to do this. Use the player's angle +/- 90 and then use the y (forward/back) offset, or more simply, use the x (left/right) offset. This example uses the x offset of 1 meter, which should be on the right of the player.

pawn Код:
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);

// The variables x, y and z are used to hold the initial player's position,
// and the position after the offset calculation will also be stored in them
// (no need for two sets of variables really)
GetCoordinateOffsets(x, y, z, a, 1, 0, 0, x, y, z);
This function is 2D, and doesn't work for x/y rotation of vehicles/objects, so for example, if a vehicle is driving along a road normally and you get the position on the right of it, it'll be fine, but if the vehicle is upside down, it will still be in the same place relative to the world, not on the other side where it should be. This generally isn't an issue though. The Z offset simply increases or decreases the source Z.
Reply


Messages In This Thread
GetXYInAngleOfPlayer ? - by RedFusion - 18.07.2013, 00:56
Re: GetXYInAngleOfPlayer ? - by MP2 - 18.07.2013, 00:58

Forum Jump:


Users browsing this thread: 1 Guest(s)