pocketmine\Player::canInteract PHP Method

canInteract() public method

public canInteract ( Vector3 $pos, $maxDistance, $maxDiff = 0.5 )
$pos pocketmine\math\Vector3
    public function canInteract(Vector3 $pos, $maxDistance, $maxDiff = 0.5)
    {
        $eyePos = $this->getPosition()->add(0, $this->getEyeHeight(), 0);
        if ($eyePos->distanceSquared($pos) > $maxDistance ** 2) {
            return false;
        }
        $dV = $this->getDirectionPlane();
        $dot = $dV->dot(new Vector2($eyePos->x, $eyePos->z));
        $dot1 = $dV->dot(new Vector2($pos->x, $pos->z));
        return $dot1 - $dot >= -$maxDiff;
    }
Player