|
@@ -94,7 +94,38 @@ export default class Signal {
|
|
|
this._room._userAvatar && (this._room._userAvatar.motionType = attitude)
|
|
|
}
|
|
|
if(this._room.sceneManager.getCurrentShaderMode() !== ECurrentShaderMode.pano && !this._room.isPano && currentUserStates.playerState.camera){
|
|
|
- this._room.camera.setCameraPose(currentUserStates.playerState.camera)
|
|
|
+ // console.error(currentUserStates.playerState)
|
|
|
+
|
|
|
+ // ---------------------------------------------------------------------------------
|
|
|
+ // 周恩光 自定义相机的初始朝向
|
|
|
+ let cameraDirOffset = -Math.PI/2
|
|
|
+
|
|
|
+ let cameraPostion0 = currentUserStates.playerState.camera.position
|
|
|
+ let cameraAngle0 = currentUserStates.playerState.camera.angle
|
|
|
+ let playerPosition = currentUserStates.playerState.player.position
|
|
|
+
|
|
|
+ let rotationQuaternion = BABYLON.Quaternion.RotationAxis( new BABYLON.Vector3(0, 0, 1), cameraDirOffset )
|
|
|
+ let cameraPos = new BABYLON.Vector3( cameraPostion0.x, cameraPostion0.y, cameraPostion0.z )
|
|
|
+ let cameraCenter = new BABYLON.Vector3( playerPosition.x, playerPosition.y, playerPosition.z )
|
|
|
+
|
|
|
+ cameraPos.rotateByQuaternionAroundPointToRef(rotationQuaternion, cameraCenter, cameraPos)
|
|
|
+
|
|
|
+ let cameraState = {
|
|
|
+ "position": {
|
|
|
+ "x": cameraPos.x,
|
|
|
+ "y": cameraPos.y,
|
|
|
+ "z": cameraPos.z
|
|
|
+ },
|
|
|
+ "angle": {
|
|
|
+ "pitch": cameraAngle0.pitch,
|
|
|
+ "yaw": cameraAngle0.yaw + cameraDirOffset/Math.PI*180,
|
|
|
+ "roll": cameraAngle0.roll
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this._room.camera.setCameraPose(cameraState)
|
|
|
+ // ---------------------------------------------------------------------------------
|
|
|
+
|
|
|
+ // this._room.camera.setCameraPose(currentUserStates.playerState.camera)
|
|
|
|
|
|
//console.log('接收数据setCameraPose:'+JSON.stringify(currentUserStates.playerState.camera.angle))
|
|
|
console.log('我们计算:'+ util.ue4Rotation2Xverse(currentUserStates.playerState.camera.angle).y/Math.PI*180)
|