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 = 1.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("玩家未受到攻击。");  
        }  
    }  
}