Author Topic: Client-Sided getEyePoint() and getEyeVector()  (Read 1978 times)

From my Client_TMBI mod on rtb

Code: [Select]
function tmbi_getfocuspos()
{
%dist = getfocusdistance();
%eye = tmbi_getmyeyepoint();
%vec = serverconnection.getcontrolobject().getmuzzlevector(0);
%vec = vectorscale(%vec, %dist);
return vectoradd(%eye, %vec);
}

function tmbi_getmyeyepoint()
{
%player = serverconnection.getcontrolobject();

if(!isobject(%player))
return "0 0 0";
%pos = %player.getposition();
%vec = %player.getforwardvector();
%scale = %player.getscale();
%x = getword(%pos, 0) + (getword(%vec, 0)*0.14 + 0.002)*getword(%scale, 0); //me no likey
%y = getword(%pos, 1) + (getword(%vec, 1)*0.14 + 0.002)*getword(%scale, 1);
%z = getword(%pos, 2) + (getword(%player.getdatablock().boundingbox, 2)/4.92 - $mvtriggercount3*1.53 + 0.002)*getword(%scale, 2); //optimized for standard blockhead, good luck otherwise
return %x SPC %y SPC %z;
}

note that this messes up slightly if the player is sitting

Elaboration:
I want to be able to look at an object and get its Object ID, or something that could lead me to its ID, sort of like client-sided /getID.

P.S. Nexus that helped a TON! The functions are amazingly helpful.

I still need an alternative to container raycasts, though.

P.P.S. What are those functions used for in TMBI anyway?
« Last Edit: March 02, 2013, 01:20:02 AM by redoctober2009 »

Elaboration:
I want to be able to look at an object and get its Object ID, or something that could lead me to its ID, sort of like client-sided /getID.

P.S. Nexus that helped a TON! The functions are amazingly helpful.

I still need an alternative to container raycasts, though.

P.P.S. What are those functions used for in TMBI anyway?
what do you plan on doing once you get their ID