Calculate angle between two players and get heading?
#4

Well, sorry about my bad definitions above, yea I was looking for something like the angle of the player (a),



Basically what I was trying to say

I need the angle in order to for example change the heading of an object according to player B's position.


EDIT 1:

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
Not sure if this is what you are looking for..
pawn Код:
stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    // Created by ******

    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));
}
This code, ain't that just figuring out the x's & y's in the players heading direction? or did i misunderstand that aswell?
Sorry, i might need to read some maths here!


Edit 2:

https://www.youtube.com/watch?v=QsVh-nFg-Vk > That is basically showing an object rotating itself towards the player. How to get the heading? I am interested in knowing how you can get the heading towards a player (same concept)
Reply


Messages In This Thread
Calculate angle between two players and get heading? - by denNorske - 29.10.2014, 04:08
Re: Calculate angle between two players and get heading? - by BroZeus - 29.10.2014, 04:29
Re: Calculate angle between two players and get heading? - by Threshold - 29.10.2014, 04:33
Re: Calculate angle between two players and get heading? - by denNorske - 29.10.2014, 04:57

Forum Jump:


Users browsing this thread: 1 Guest(s)