SA-MP Forums Archive
Math. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Math. (/showthread.php?tid=184916)



Math. - Bessensap - 22.10.2010

Hey, I'm making something and now i need to do something which isnt my strongest part. I have 2 Points

The Player Camera Pos
The Player Pos


Now i want to make an object that is pointing forward, viewing from the camera, HOW?

I know its possible i just have know idea how, its probably something with sincostan

If you dont understand what my point is, post please.


Re: Math. - HrvojeCro - 22.10.2010

dont get it
as i fugred out you want to make object pointing to player
so just make object in mta map editor save player pos and camera pos behind that object, thats it


Re: Math. - LarzI - 22.10.2010

You want an object which is "facing" the camera, and camera is facing the object so you can see the front of the object?


Код:
back of object > []------------[] < back of camera
                         ^
             line of sight (literally)



Re: Math. - Bessensap - 22.10.2010

Код:
Object   <--<---<--You(player)<----<----<---YourCamera
And now, i want the object to face that way, get it now? So that you look onto the back of the object, as LarzI said


Re: Math. - LarzI - 22.10.2010

Quote:
Originally Posted by Bessensap
Посмотреть сообщение
Код:
Object   <--<---<--You(player)<----<----<---YourCamera
And now, i want the object to face that way, get it now? So that you look onto the back of the object, as LarzI said
You misunderstood what I meant, but by misunderstanding what I meant, I got what you meant. x3


Re: Math. - Bessensap - 22.10.2010

Alright, That's good. Now all i need is the solution


Re: Math. - HrvojeCro - 22.10.2010

Quote:
Originally Posted by Bessensap
Посмотреть сообщение
Alright, That's good. Now all i need is the solution
then make object in MTA MAP EDITOR behind your player at spawn point... simple
EDIT: you can rotate objects in mta too


Re: Math. - Bessensap - 22.10.2010

Quote:
Originally Posted by HrvojeCro
Посмотреть сообщение
then make object in MTA MAP EDITOR behind your player at spawn point... simple
EDIT: you can rotate objects in mta too
*sigh*

You obviously don't get it.
It's not 1 object, theres going to be a greater number of objects, which will spawn where my camera is looking, but i want the object to point in the same direction


AW: Math. - Cank - 22.10.2010

i don`t think thats what he wants.

if i understood correctly, you need this function: (from ******)

pawn Код:
stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y,       Float:distance) {                                                       
    new
        vid=GetPlayerVehicleID(playerid),
        Float:a;
    if (vid) {
        GetVehiclePos(vid,x,y,a);
        GetVehicleZAngle(vid, a);
    }
    else {
        GetPlayerPos(playerid, x, y, a);
        GetPlayerFacingAngle(playerid, a);
    }
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}
then CreateObject with these coordinates


Re: Math. - Bessensap - 22.10.2010

Already have that one, but not what im looking for. Its about the CAMERA POS and not where the vehicle/player is facing, and it already makes the object etc all i want is to make it point forward