Blockland Forums > Modification Help
Code for directly behind a person
(1/1)
Munkey:
How would I use vectors to get directly behind a person?
This is what I have:

--- Code: ---    %pi = 3.1415926;
    %pl = %mV;
    %vect = %pl.getForwardVector();
    %angle = mAsin(getWord(%vect, 0), getWord(%vect, 1));
    %angle += %pi/2;
    %vectX = mtan(%angle);
    %vectY = mcos(%angle);
    %scale = mSqrt(mPow(%vectX, 2) + mPow(%vectY, 2));
    %dist = 3;
    %mod = %dist/%scale;
    %vectX *= %mod;
    %vectY *= %mod;
    %x = getWord(%pl.position, 0) + %vectX;
    %y = getWord(%pl.position, 1) + %vectY;
    %z = getWord(%pl.position, 2);
%pos = %x SPC %y SPC %z;

--- End code ---
Gojira:
and this is for making a TF2-style butterfly knife/backburner?
i dunno.
Amade:

--- Code: ---%backVec = vectorScale(%obj.getForwardVector(), -1);
--- End code ---
Navigation
Message Index

Go to full version