2016-09-21 33 views
2

一個簡單的問題。我用了4-6個小時來找到這個,但沒有找到。如何反轉A幀中的拖動旋轉?

例,林建全景圖查看<a-sky>

<script src="https://aframe.io/releases/0.3.0/aframe.min.js"></script> 
 

 

 
<a-scene> 
 
    <a-sky src="https://aframe.io/aframe/examples/boilerplate/panorama/puydesancy.jpg" rotation="0 -130 0"></a-sky> 
 
</a-scene>

如何反轉輪替]通過拖動鼠標(從左到右,從右到左 - 這樣的事情)

+1

我會發佈一個組件,爲您獲得預期的行爲。基本上分叉查看控制並反轉鼠標拖動。我相信Don McCurdy的aframe-extras控制也可以逆轉。 – ngokevin

+0

@ngokevin謝謝,我應該在Github上打開一個問題嗎? – l2aelba

+1

我已經在下面發佈了一個答案。它早先被mod刪除,但現在又回來了。 – ngokevin

回答

2

我出版了一本反向查找控制組件,直到我們推出更多可擴展的控制。

反向查找控制組件:https://github.com/ngokevin/kframe/tree/master/components/reverse-look-controls


演示:

<script src="https://aframe.io/releases/0.3.0/aframe.min.js"></script> 
 
<script src="https://rawgithub.com/ngokevin/kframe/master/components/reverse-look-controls/dist/aframe-reverse-look-controls-component.min.js"></script> 
 

 
<a-scene> 
 
    <a-entity camera reverse-look-controls></a-entity> 
 
    <a-sky src="https://aframe.io/aframe/examples/boilerplate/panorama/puydesancy.jpg" rotation="0 -130 0"></a-sky> 
 
</a-scene>

+0

儘管這個鏈接可能回答這個問題,但最好在這裏包含答案的重要部分,並提供供參考的鏈接。如果鏈接頁面更改,則僅鏈接答案可能會失效。 - [來自評論](/ review/low-quality-posts/13751418) – tarzanbappa

+0

謝謝,但它鏈接到我提供解決方案的第三方模塊。如果沒有以某種方式使用鏈接,沒有任何方法。 – ngokevin

+0

謝謝,這是安全的使用? – l2aelba

3

A型架0.6.0

現在,使用相機上的look-controls="reverseMouseDrag: true"屬性可以將框架內部的旋轉方向反轉。

<script src="https://aframe.io/releases/0.6.0/aframe.min.js"></script> 
 

 

 
<a-scene> 
 
    <a-entity camera look-controls="reverseMouseDrag: true"></a-entity> 
 
    <a-sky src="https://aframe.io/aframe/examples/boilerplate/panorama/puydesancy.jpg" rotation="0 -130 0"></a-sky> 
 
</a-scene>

- according to this issue這仍然只能用鼠標拖動桌面機的工作原理,並且不帶觸摸拖動移動工作。

+0

謝謝,我會在修復時接受這個答案。 (仍然不適用於移動設備上的0.6.1) – l2aelba

0

實施0.6.0後,我覺得這不是在a-videosphere上運行時的預期行爲。

我能夠通過改變線67607和67608有* -1

AFRAME-v0.6.0.js

var currentRotationX = radToDeg(this.pitchObject.rotation.x * -1); 
var currentRotationY = radToDeg(this.yawObject.rotation.y * -1);