|
@@ -373,8 +373,58 @@ export default class ActionsHandler {
|
|
}
|
|
}
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
+ //zeg
|
|
|
|
+ rotate({type: type, offsetX: offsetX, width: width}) {
|
|
|
|
+ //camera的position,angle
|
|
|
|
+ //起始和结束的帧
|
|
|
|
|
|
- rotate({type: type, angle: angle}) {
|
|
|
|
|
|
+ let angle = offsetX / width * 2 * Math.PI
|
|
|
|
+ let endRotation = util.xverseRotation2Ue4(window.room.sceneManager.cameraComponent.mainCamera.rotation).yaw
|
|
|
|
+ endRotation = (endRotation % 360 + 360) % 360
|
|
|
|
+
|
|
|
|
+ let sfns = Math.round(endRotation/6)
|
|
|
|
+ endRotation += angle/Math.PI*180
|
|
|
|
+
|
|
|
|
+ let efns = Math.round(endRotation/6)
|
|
|
|
+
|
|
|
|
+ console.log('取帧:'+sfns+','+efns);
|
|
|
|
+ this.fetchData({
|
|
|
|
+ type:type,
|
|
|
|
+ sFrame:sfns,
|
|
|
|
+ eFrame:efns
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ this.room.sceneManager.materialComponent.initreceveFrames()
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ let cameraPostion0 = util.xversePosition2Ue4(window.room.sceneManager.cameraComponent.mainCamera.position.clone())
|
|
|
|
+ let playerPosition = window.room.sceneManager.avatarComponent._mainUser.position
|
|
|
|
+
|
|
|
|
+ let rotationQuaternion = BABYLON.Quaternion.RotationAxis( new BABYLON.Vector3(0, 0, 1), angle )
|
|
|
|
+ let cameraPos = new BABYLON.Vector3( cameraPostion0.x, cameraPostion0.y, cameraPostion0.z )
|
|
|
|
+ let cameraCenter = new BABYLON.Vector3( playerPosition.x, playerPosition.y, playerPosition.z )
|
|
|
|
+ // console.error(cameraPos, cameraCenter)
|
|
|
|
+
|
|
|
|
+ cameraPos.rotateByQuaternionAroundPointToRef(rotationQuaternion, cameraCenter, cameraPos)
|
|
|
|
+
|
|
|
|
+ let cameraState = {
|
|
|
|
+ "position": {
|
|
|
|
+ "x": cameraPos.x,
|
|
|
|
+ "y": cameraPos.y,
|
|
|
|
+ "z": cameraPos.z
|
|
|
|
+ },
|
|
|
|
+ "angle": {
|
|
|
|
+ "pitch": 0,
|
|
|
|
+ "yaw": endRotation,
|
|
|
|
+ "roll": 0
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ window.room.sceneManager.cameraComponent.mainCamera.rotation.y += angle
|
|
|
|
+ window.room.sceneManager.cameraComponent.setCameraPose(cameraState)
|
|
|
|
+ }
|
|
|
|
+ /*
|
|
|
|
+ rotate0({type: type, angle: angle}) {
|
|
let endRotation = window.room.sceneManager.cameraComponent.mainCamera.rotation.y
|
|
let endRotation = window.room.sceneManager.cameraComponent.mainCamera.rotation.y
|
|
if(endRotation<0){
|
|
if(endRotation<0){
|
|
endRotation += 2*Math.PI
|
|
endRotation += 2*Math.PI
|
|
@@ -402,10 +452,11 @@ export default class ActionsHandler {
|
|
|
|
|
|
this.room.sceneManager.materialComponent.initreceveFrames()
|
|
this.room.sceneManager.materialComponent.initreceveFrames()
|
|
|
|
|
|
- // this.room.sceneManager.cameraComponent.mainCamera.rotation.y = endRotation
|
|
|
|
- // window.room.sceneManager.cameraComponent._cameraPose.rotation._y = endRotation
|
|
|
|
|
|
+ this.room.sceneManager.cameraComponent.mainCamera.rotation.y = endRotation
|
|
|
|
+ window.room.sceneManager.cameraComponent._cameraPose.rotation._y = endRotation
|
|
window.room.sceneManager.cameraComponent.mainCamera.rotation.y=endRotation
|
|
window.room.sceneManager.cameraComponent.mainCamera.rotation.y=endRotation
|
|
}
|
|
}
|
|
|
|
+ */
|
|
|
|
|
|
fetchData({sFrame: sfns, eFrame: efns}){
|
|
fetchData({sFrame: sfns, eFrame: efns}){
|
|
if(window.workerReady){
|
|
if(window.workerReady){
|