Coordintaes
#1

So, the idea is to make and object appear right in front of a player's character, in the derection it is lokking. I've found a couple of mathematic formulas on the Net but the don't seem to work properly. So, how can I solve this problem?
Reply
#2

Код:
getCoordsInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:Distance)
{
    new
		Float:r;
    if(!IsPlayerInAnyVehicle(playerid)) {
		GetPlayerFacingAngle(playerid,r);
	}
    else {
		GetVehicleZAngle(GetPlayerVehicleID(playerid),r);
	}
    x += (Distance * floatsin(-r, degrees));
    y += (Distance * floatcos(-r, degrees));
    return 1;
}
Taken from literally the only result I got from ****** lmao xD


Anyhow use this to get coordinations in front of the player and then use CreateDynamicObject (highly suggeting you use this instead of CreateObject) and poof.
Reply
#3

The formula I was using is pretty similar to this one. Apperetnly I messed it up somewhere.
Anyway, thanks for your help, it does work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)