有没有一种方法可以将垂直旋转平移添加到react-viro 360图像组件?

时间:2019-06-11 15:02:40

标签: javascript reactjs react-native

我需要为我在react-native中开发的应用添加垂直旋转平移到react-viro相机中,在两个月内我还没有找到解决此问题的方法,这是我的第一个应用开发经验,使它以任何方式工作可行吗?

根据https://github.com/viromedia/viro/issues/103,我设法添加了水平旋转和越野车垂直旋转 他们在这里说,垂直平移引发了一些我无法处理的越野车问题。

 setPanAndZoom=(gesture,isPanning)=>{

    // this.setState({panning:true});

    let distanceX=gesture.x0-gesture.moveX;
    let normalVectorX=distanceX/this.screenWidth;
    let newAngleX=normalVectorX*this.rotateSensivity;

    let distanceY=gesture.y0-gesture.moveY;
    let normalVectorY=distanceY/this.screenWidth;
    let newAngleY=normalVectorY*this.rotateSensivity;



    if(isPanning){
            this.camera.setNativeProps({
                rotation:[this.currentAngleY+newAngleY,this.currentAngleX+newAngleX,0]
            })
    } else
        {
             this.currentAngleX=this.currentAngleX+newAngleX;
             this.currentAngleY=this.currentAngleY+newAngleY;
    }
}







     this.pan=PanResponder.create({
        onStartShouldSetPanResponder:()=>{
            return true
        },
        onPanResponderMove:(event,gesture)=>{
            this.setPanAndZoom(gesture,true)
        },
        onPanResponderRelease:(event,gesture)=>{

            this.setPanAndZoom(gesture,false)

        },

    })

垂直旋转似乎不能像他们自己所说的那样完美

0 个答案:

没有答案
相关问题