Author Topic: Figure Out the Player at Whom Another Player is Looking  (Read 452 times)

How do I find out who a player is looking at when he/she clicks the mouse? I realize that Armor::onTrigger will tell us when the player clicks, but I can't figure out how to find the player who is getting clicked.

taken from the click push script, this should work?
Code: [Select]
package Script_ClickPush
{
function Player::activateStuff(%player)
{
%v = Parent::activateStuff(%player);
%client = %player.client;

if(!$ClickPush::Status || (!%client.isAdmin && $ClickPush::AdminOnly))
return %v;

%target = containerRayCast(%player.getEyePoint(),vectorAdd(vectorScale(vectorNormalize(%player.getEyeVector()),2),%player.getEyePoint()),$TypeMasks::PlayerObjectType,%player);

if(!isObject(%target) || %target == %player || %player.getObjectMount() == %target)
return %v;

%target.setVelocity(vectorAdd(%target.getVelocity(),vectorScale(%player.getEyeVector(),$ClickPush::Amount)));

return %v;
}
};
activatePackage(Script_ClickPush);

taken from the click push script, this should work?
-code-
Why thank you, phlack. That worked like a charm.