You can get the objects position (assuming its not a player or a bot) just with getTransform()
However, getting the point you are aiming at is a lot harder. It can be done client sided with math and a lot of tweaking to make it accurate. I actually have some code which does this. It is not as accurate as it can be, however it is pretty good.
package packageName
{
function crouch(%a)
{
$isCrouching = %a;
return parent::crouch(%a);
}
};
activatePackage(packageName);
function getFocusPos()
{
%dist = getFocusDistance();
%eye = getMyEyePoint();
%vec = serverConnection.getControlObject().getMuzzleVector(0);
%vec = vectorScale(%vec, %dist);
return vectorAdd(%eye, %vec);
}
function 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 + $isCrouching*1.53 + 0.002)*getWord(%scale, 2); //optimized for standard blockhead, good luck otherwise
return %x SPC %y SPC %z;
}
Note: This isnt my code, i think i found it on the forums somewhere after lots of searching.
EDIT: Actually, i think getYawPitch is part of another script.. I cant see it being used anywhere..
Nope, its not. Removed it.