Jump to content
  • 0

pomoc Rampy, Objekt :D


pe.vanasek

Dotaz

Ahoj lidi mám, potřebuju radu :)

 

Chci udělat rampy......ale vždy se mi spawne jinak někdy před sebe a někdy ne no..

 

GetPlayerPos(playerid, x, y, z);

CreateObject(13641, x, y, z, rx, ry, rz);

 

Todle je jasný :)))

 

Ale já spíš potřebuju, jestly neexistuje něco jako:

 

new Float:angle;

GetPlayerFacingAngle(playerid,angle);

SetVehicleZAngle(playerid, angle);

 

Tak jestly něco stejného neexistuje nějaká funkce stejná jako SetVehicleZAngle, Akorát, že by to bylo na natočení objektu.........

 

Budu rád za každou radu :d

Link to comment
Share on other sites

9 odpovědí na tuto otázku

Recommended Posts

  • 0


// vytvoření rampy
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
GetXYInFrontOfPlayer(playerid, x, y, 3.0);
CreateObject(13641, x, y, z, rx, ry, a); //pokud se nemýlím, je to RZ pro nastavení směru (něco jako na vozidle)



// fce GetXYInFrontOfPlayer
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance) //by Y_Less
{
    new Float:a;
    GetPlayerPos(playerid, x, y, a);
    GetPlayerFacingAngle(playerid, a);
    if (GetPlayerVehicleID(playerid))
    {
     GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}



 

Doufám, že to bude fungovat  :)

 

Link to comment
Share on other sites

  • 0
// vytvoření rampy
GetPlayerFacingAngle(playerid, a); // Zjistí, kam se hráč dívá - následné nastavení rotace objektu
GetPlayerPos(playerid, x, y, z); // Zjistí aktuální pozici hráče
GetXYInFrontOfPlayer(playerid, x, y, 3.0); // Zjistí pozici před hráčem - nevím, jak to funguje, využívá to goniometrické funkce; není to mé
CreateObject(13641, x, y, z, rx, ry, a); // Vytvoří objekt na pozici před hráčem - x a y byly upraveny funkcí GetXYInFrontOfPlayer
// samotná fce GetXYInFrontOfPlayer
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance) //by Y_Less
{
    new Float:a;
    GetPlayerPos(playerid, x, y, a); // zjištění pozice x, y a z jako a
    GetPlayerFacingAngle(playerid, a); // zjištění pohledu hráče
    if (GetPlayerVehicleID(playerid)) // pokud je ve vozidle
    {
     GetVehicleZAngle(GetPlayerVehicleID(playerid), a); // zjištění pohledu vozidla
    }
    x += (distance * floatsin(-a, degrees)); // výpočet souřadnice x pomocí sinusu
    y += (distance * floatcos(-a, degrees)); // výpočet souřadnice y pomocí cosinusu
}

Snad to stačí :d

Link to comment
Share on other sites

  • 0
stock GetXYInFrontOfPoint(&Float:x,&Float:y,Float:angle,Float:distance)
{
	x += (distance * floatsin(-angle,degrees));
	y += (distance * floatcos(-angle,degrees));
}

Ta fce funguje takto:

x,y vyjadruji bod

angle je uhel, kerym chces ten bod "posunout"

distance je o jakou vzdalenost ho chces posunout

ten stock ti ten x a y predela, vysledkem bude posunuty bod tim uhlem a o tu vzdalenost

 

samotny matematicky vyznam se uci tusim v analiticke geometrii ve tretim rocniku stredni skoly.

new Float:x,Float:y,Float:z,Float:a;
GetPlayerFacingAngle(playerid,a);
GetPlayerPos(playerid, x, y, z);
GetXYInFrontOfPoint(x,y,a,3.0);
CreateObject(13641, x, y, z, rx ry,a+90);
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...