--- outline: [2, 3] --- # DrillingRobot - 源文件:`packages/sdk/src/robot/DrillingRobot.ts` - 文档位置:`packages/docs/api/robot/DrillingRobot.md` ## 接口:`IDrillingRobotOptions` - 作用:钻进机器人配置 ### 字段 | 字段名 | 类型 | 必填 | 作用 | | --- | --- | --- | --- | | `pipeRadius` | `number` | 是 | 管道半径(用于计算机器人尺寸) | | `color` | `number` | 否 | 机器人颜色 | | `cylinderLengthRatio` | `number` | 否 | 圆柱体长度系数(相对于管道半径) | | `coneLengthRatio` | `number` | 否 | 圆锥体长度系数(相对于管道半径) | ## 类:`DrillingRobot` - 作用:钻进机器人 由圆柱体和圆锥体组成,用于模拟钻进过程 ### 构造函数 #### `new DrillingRobot(options: IDrillingRobotOptions)` - 作用:创建钻进机器人 - 入参: | 参数名 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `options` | `IDrillingRobotOptions` | 是 | - 机器人配置选项 | - 出参:`DrillingRobot` - 返回说明:返回当前类实例。 ### 属性 | 属性名 | 可见性 | 类型 | 作用 | | --- | --- | --- | --- | | `group` | `public` | `THREE.Group` | 用于保存 `group` 对应的数据。 | | `cylinder` | `public` | `THREE.Mesh` | 用于保存 `cylinder` 对应的数据。 | | `cone` | `public` | `THREE.Mesh` | 用于保存 `cone` 对应的数据。 | | `options` | `public` | `Required` | 用于保存 `options` 对应的数据。 | ### 方法 #### `setPosition(position: THREE.Vector3): void` - 作用:设置机器人位置 - 入参: | 参数名 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `position` | `THREE.Vector3` | 是 | - 位置向量 | - 出参:`void` - 返回说明:无返回值。 #### `setRotation(quaternion: THREE.Quaternion): void` - 作用:设置机器人旋转 - 入参: | 参数名 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `quaternion` | `THREE.Quaternion` | 是 | - 旋转四元数 | - 出参:`void` - 返回说明:无返回值。 #### `setDirection(direction: THREE.Vector3): void` - 作用:设置机器人朝向 - 入参: | 参数名 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `direction` | `THREE.Vector3` | 是 | - 方向向量 | - 出参:`void` - 返回说明:无返回值。 #### `updateSize(pipeRadius: number): void` - 作用:更新机器人尺寸(当管道半径改变时) - 入参: | 参数名 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `pipeRadius` | `number` | 是 | - 新的管道半径 | - 出参:`void` - 返回说明:无返回值。 #### `dispose(): void` - 作用:销毁机器人资源 - 入参:无 - 出参:`void` - 返回说明:无返回值。 ## 构造示例 - 当前 Demo 中没有直接展示 `DrillingRobot` 的构造调用。 ## 函数示例 - 当前 Demo 中没有直接展示 `DrillingRobot` 的公开方法调用。