LCCObject::setRotation
设置 LCC 模型的旋转。
在 LCC 模型空间下进行旋转。
版本要求
SDK v0.3.1+
引擎支持
CesiumJS
API
LCCObject::setRotation(rotation: Cesium.Matrix3 | { heading: number, pitch: number, roll: number } | Cesium.HeadingPitchRoll): void
参数
| 参数 | 类型 | 必选 | 默认值 | 描述 |
|---|---|---|---|---|
rotation | Cesium.Matrix3 / { heading: number, pitch: number, roll: number } / Cesium.HeadingPitchRoll | 是 | - | SDK v0.6.3 之前传入 Cesium.Matrix3 旋转矩阵;SDK v0.6.3+ 基于 ENU 坐标系,传入包含 heading、pitch、roll 的对象或 Cesium.HeadingPitchRoll。 |
返回值
void
使用示例
SDK v0.3.1 ~ v0.6.2
const matrix3 = new Cesium.Matrix3();
lccObject.setRotation(matrix3);
SDK v0.6.3+(ENU 坐标系)
从 v0.6.3 开始,旋转基于 ENU 坐标系,参数变更为 heading、pitch、roll 三个转动角度。
lccObject.setRotation({ heading: 1, pitch: 0, roll: 0 });
也可以使用 Cesium.HeadingPitchRoll:
const hpr = new Cesium.HeadingPitchRoll(1, 0, 0);
lccObject.setRotation(hpr);
注意事项
- 此接口需在
LCCRender.load()的成功回调函数触发后调用。
相关 API
LCCObject::setScale()LCCObject::setOriginPosition()