public class CharacterModel {  
    private Vector3D position; // 人物的位置  
    private double hitboxRadius; // 受击范围的半径  
  
    public CharacterModel(Vector3D position, double hitboxRadius) {  
        this.position = position;  
        this.hitboxRadius = hitboxRadius;  
    }  
  
    // 判断一个点是否在人物的受击范围内  
    public boolean isWithinHitRange(Vector3D otherPosition) {  
        double distanceSquared = position.distanceSquared(otherPosition);  
        double hitboxRadiusSquared = hitboxRadius * hitboxRadius;  
        return distanceSquared <= hitboxRadiusSquared;  
    }  
  
    // 内部类，表示三维向量  
    public static class Vector3D {  
        public double x, y, z;  
  
        public Vector3D(double x, double y, double z) {  
            this.x = x;  
            this.y = y;  
            this.z = z;  
        }  
  
        // 计算两个三维向量之间的距离的平方  
        public double distanceSquared(Vector3D other) {  
            double dx = this.x - other.x;  
            double dy = this.y - other.y;  
            double dz = this.z - other.z;  
            return dx * dx + dy * dy + dz * dz;  
        }  
    }  
  
    // 测试代码  
    public static void main(String[] args) {  
        Vector3D playerPosition = new Vector3D(0, 0, 0); // 玩家位置  
        double hitboxRadius = 2.5; // 受击范围半径  
        CharacterModel player = new CharacterModel(playerPosition, hitboxRadius);  
  
        Vector3D bulletPosition = new Vector3D(1, 1, 1); // 子弹位置  
  
        if (player.isWithinHitRange(bulletPosition)) {  
            System.out.println("玩家受到攻击！");  
        } else {  
            System.out.println("玩家未受到攻击。");  
        }  
    }  
}