Author Topic: The Position Behind A Player  (Read 1388 times)

Hi again :/

I need to know how to get the position directly behind a player. I have some code to get the position in front of them but I don't know how to reverse it:
Code: [Select]
function getPosInFrontOfPlayer(%player,%dist)
{
    return vectorAdd(%player.getEyePoint(),vectorScale(%player.getEyeVector(),%dist));
}


« Last Edit: November 26, 2012, 11:29:37 AM by chrisbot6 »

No, use vectorScale and -1 to invert the vector

Try %dist * -1

Or just -%dist which is simpler and more readable (in my opinion, at least)

Or just -%dist which is simpler and more readable (in my opinion, at least)
%dist - %dist - %dist
2 * (%dist / 2 - %dist)
firstWord(vectorAdd(vectorSub(%dist, %dist), vectorScale(%dist, -1)))

%dist - %dist - %dist
2 * (%dist / 2 - %dist)
firstWord(vectorAdd(vectorSub(%dist, %dist), vectorScale(%dist, -1)))

Code: [Select]
function retrieveData()
{
   for(%i=0;%i<999999;%i++) doNothing();   //Make the function really slow so people think important stuff is happening
   echo("Data retrieved");
}

function doNothing() { }

Code: [Select]
function retrieveData()
{
   for(%i=0;%i<999999;%i++) doNothing();   //Make the function really slow so people think important stuff is happening
   echo("Data retrieved");
}

function doNothing() { }
Wtf use a schedule then

Wtf use a schedule then
Doesn't hold up the game.

Code: [Select]
function retrieveData(%data)
{
for(%i=0;%i<999999;%i++)
doNothing(%i);
echo("Data retrieved");
return %data;
}

function doNothing(%i)
{
if(%i <= 0)
return;
initContainerRadiusSearch("0 0 0", %i, $TypeMasks::All);
%lastPos = "0 0 0";
while((%target = ContainerSearchNext()) != 0)
{
%ray = containerRayCast(%lastPos, %target.getPosition(), $TypeMasks::All, %target);
%lastpos = %target.getPosition();
switch(getWord(%ray, 0))
{
default:
continue;
}
}
doNothing(%i - 1);
}

Doesn't hold up the game.
Why do you want to create massive lag?

Why do you want to create massive lag?

Because we're getting a large amount of nonexistant data!

Why do you want to create massive lag?
i think the joke just went right over your head