119
« on: July 03, 2013, 02:02:56 PM »
I'm trying to implement a 'radar' for a gamemode I'm working on, but after testing it with a non-existant runway, I noticed that lines distort wildly if you get close to them.
%loc = vectorSub(DirRadarHUD.realPos[%i], %pos);
if((%ang = vectorDot(vectorNormalize(%loc), %for)) < 0.642787)
{ if(isObject(%dot = DirRadarHUD.dot[%i])) %toDelete[-1+%toDelete++] = %dot; continue; }
%rel = SC_Solve3DMatrix(%loc, %for, %left, %up);
if(%rel $= "Unsolvable")
{ %toDelete[-1+%toDelete++] = %dot; continue; }
//V1: Way, way off
//%mult = (%ang - 1) / -0.642787;
//%rel = vectorScale(getWords(%rel, 1, 2), %mult);
//V2: Distortion near dots
%rel = vectorNormalize(getWords(%rel, 1, 2));
%rel = getWords(%rel, 1, 2);
//V3: Mathematically the same as V2 -_-
//%len = vectorLen(getWords(%rel, 1, 2));
//%mag = vectorNormalize(getWord(%rel, 0) SPC %len);
//%rel = vectorScale(vectorNormalize(getWords(%rel, 1, 2)), getWord(%mag, 1));
%x = mFloatLength(getWord(%rel, 0) * -130.541, 0) + 110;
%y = mFloatLength(getWord(%rel, 1) * -130.541, 0) + 110;
%dot = DirRadarHUD.realDot[%i];
if(!isObject(%dot))
{
DirRadarHUD.add(%dot = new GuiBitmapCtrl()
{
position = (%x - 2) SPC (%y - 2);
extent = "4 4"; minExtent = "4 4";
bitmap = "Add-Ons/Client_SpaceRadar/Dot";
index = %i;
});
}
else %dot.resize(%x - 2, %y - 2, 4, 4);
%dot.setColor(DirRadarHUD.realColor[%i]);
Attached is an image of the runway. The runway is built of five straight lines. Note that two of the three visible here are clearly distorted into something normally known as a 'curve'.
I want these to be lines. Straight lines, not curved lines.
Any ideas on how to fix this?