new CameraLerpComponent()
不需要调用构造函数,该组件内所有的方法通过app.camera.方法名称()调用
Extends
- THING.LerpComponent
Methods
-
correctCameraTarget()
-
-
correctUp()
地球模式下 校正相机的up 头朝地球于球心连线向外方向
-
-
earthCameraRotateBySpeed(param)
相机根据速度绕自身旋转
-
Parameters:
Name Type Description paramObject Properties
Name Type Attributes Default Description speedNumber <optional>
1 旋转速度 angleNumber 旋转角度 如果不传则会一直旋转 onCompletefunction <optional>
旋转完后的回调 -
earthCameraRotateByTime(param)
相机根据时间自身旋转
-
Parameters:
Name Type Description paramObject Properties
Name Type Attributes Default Description durationNumber <optional>
1000 旋转时间 单位毫秒 angleNumber <optional>
360 旋转角度 onCompletefunction <optional>
旋转完后的回调 -
earthFlyHome(param)
相机恢复初始状态 即看到整个地球的视角
-
Parameters:
Name Type Description paramObject Properties
Name Type Attributes Default Description durationNumber <optional>
1000 飞行时间 onCompletefunction 飞行完成的回调 -
earthFlyRotateBySpeed(param)
相机根据速度围绕目标点旋转
-
Parameters:
Name Type Description paramObject Properties
Name Type Attributes Default Description speedNumber <optional>
1 旋转速度 速度为负数代表与旋转角度代表的方向相反 angleNumber 旋转角度 如果不传则会一直旋转 值为正代表顺时针旋转 值为负数代表逆时针旋转 targetNumber <optional>
目标点坐标 如果不传绕当前相机目标点旋转 -
earthFlyRotateByTime(param)
相机根据时间围绕目标点旋转
-
Parameters:
Name Type Description paramObject Properties
Name Type Attributes Default Description durationNumber <optional>
0 旋转时间 单位毫秒 angleNumber <optional>
360 旋转角度 值为正代表顺时针旋转 值为负数代表逆时针旋转 targetNumber <optional>
目标点坐标 如果不传绕当前相机目标点旋转 onCompletefunction <optional>
旋转完后的回调 -
earthFlyTo(param)
地球上的飞
-
Parameters:
Name Type Description paramObject Properties
Name Type Attributes Default Description lonlatArray.<Number> 目标位置的经纬度(并非相机位置的经纬度,添加地形之后这个经纬度是是相机在数学球上的经纬度,而不是在地形上的经纬度) targetArray.<Number> | Object3D <optional>
相机目标的世界坐标或者以一个Object3D作为目标位置 如果传target则不会使用lonlat positionArray.<Number> <optional>
相机飞行结束后位置的世界坐标 如果传position 则不会使用height,pitch,heading计算相机位置 heightNumber <optional>
10000 相机位置的离地高(如果传lonlat,代表的是相机距离数学球的高度,如果传target,则代表相机距离基于target的切平面高度) durationNumber <optional>
2000 飞行时间 单位:毫秒 pitchNumber <optional>
45 飞行结束时相机的俯仰角 headingNumber <optional>
0 飞行结束时相机的方位角(相机面向正北0度,正南180度) directFlyBoolean <optional>
false 是否直接飞过去(注意 该参数为true可能会穿地飞,设置false会根据当前距离和目标位置自动分段飞行) onCompletefunction <optional>
飞行结束的回调方法 -
fit(param)
根据目标对象计算最佳位置 一般用于调整摄像机最佳视角.
-
根据目标对象计算最佳位置 一般用于调整摄像机最佳视角
Parameters:
Name Type Description param.targetTHING.Object3D 目标对象 paramObject 参数列表 Properties
Name Type Attributes Default Description timeNumber <optional>
1000 时间 onCompletefunction <optional>
飞行结束后的回调 Example
const geoPoint = app.query('.GeoPoint')[0];//假设地图上有一个GeoPoint对象 app.camera.fit(geoPoint); -
flyToBoundingSphere(param)
飞到包围球
-
Parameters:
Name Type Description paramObject 参数列表 Properties
Name Type Attributes Default Description radiusNumber 包围球半径 centerArray.<Number> 包围球中心点 durationNumber <optional>
3000 飞线时间 单位毫秒 onCompletefunction <optional>
飞行完后的回调 -
getEarthCameraInfo() → {Object}
获取地球上摄影机的参数,这里的height是基于相机位置基于圆球的高度,获取到的lonlat中不含高度该方法主要是为了获取相机角度,再调用earthFlyTo时飞到正确的位置如果添加地形的情况下,通过该方法获取的相机高度是不正确的
-
Returns:
Object - 地球上的相机参数 包括lonlat,height,heading,pitch -
rotateToNorth()
相机指北
-
Parameters:
Name Type Attributes Default Description param.durationNumber <optional>
0 飞行时间 单位毫秒 param.onCompletefunction <optional>
飞行完后的回调 -
stopEarthFly()
停止地球上的相机飞行或旋转
-