Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: ThunderStorm on Nov 13, 2014, 06:57 AM

Title: GetForwardPoint help
Post by: ThunderStorm on Nov 13, 2014, 06:57 AM
Quote// [Ka]Juppi's func from http://forum.liberty-unleashed.co.uk/index.php/topic,398.0.html
// ported to fit your needs
function GetForwardPoint( pos, angle ) // you must pass an angle in degrees
{
local rad = angle * PI / 180; // we convert to radians
                local x = pos.x, y = pos.y;
local x2 = x + 1.0 * cos(rad) - 25.0 * sin(rad); // we calculate
local y2 = y + 1.0 * sin(rad) + 25.0 * cos(rad);
                return Vector( x2, y2, pos.z ); // return a vector
}

local veh = FindPlayer(0).Vehicle; veh.Pos = GetForwardPoint(veh.Pos,veh.EulerAngle.z);
This didn't work, heads me towards north ( slightly ), in every angle
Title: Re: GetForwardPoint help
Post by: ysc3839 on Nov 13, 2014, 10:03 AM
local rad = angle; // we needn't convert to radians
Title: Re: GetForwardPoint help
Post by: ThunderStorm on Nov 13, 2014, 10:16 AM
Quote from: ysc3839 on Nov 13, 2014, 10:03 AMlocal rad = angle; // we needn't convert to radians
Tried, but only works with north and east
Title: Re: GetForwardPoint help
Post by: ysc3839 on Nov 15, 2014, 03:16 PM
Quote from: ThunderStorm on Nov 13, 2014, 10:16 AM
Quote from: ysc3839 on Nov 13, 2014, 10:03 AMlocal rad = angle; // we needn't convert to radians
Tried, but only works with north and east
Try veh.Pos,veh.Angle.z ?
Title: Re: GetForwardPoint help
Post by: ThunderStorm on Nov 16, 2014, 06:57 AM
Quote from: ysc3839 on Nov 15, 2014, 03:16 PMTry veh.Pos,veh.Angle.z ?
Nope