2016-09-21 52 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);