加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – 放大Qt3D的相机

发布时间:2020-12-16 07:22:11 所属栏目:百科 来源:网络整理
导读:如何实现Qt3D相机FOV的双指捏手势处理? 有FirstPersonCameraController和OrbitCameraController相机控制器,可以处理鼠标/触摸板事件.后者甚至具有zoomLimit属性,但其含义不是我需要缩放场景(从立方体贴图内部,摄像机位置固定为(0,0)).我用前者.它正确处理鼠
如何实现Qt3D相机FOV的双指捏手势处理?

有FirstPersonCameraController和OrbitCameraController相机控制器,可以处理鼠标/触摸板事件.后者甚至具有zoomLimit属性,但其含义不是我需要缩放场景(从立方体贴图内部,摄像机位置固定为(0,0)).我用前者.它正确处理鼠标拖动和单指触摸事件,但不处理双指捏状手势.

我可以用简单的方式自定义PinchArea与Qt3D的相机进行交互吗?或Qt Quick的API在这个意义上与Qt3D的API正交?

解决方法

使用PinchArea的pinchUpdated事件查找有关Pinch的信息:根据文档

The pinch parameter provides information about the pinch gesture,
including the scale,center and angle of the pinch. These values
reflect changes only since the beginning of the current gesture,and
therefore are not limited by the minimum and maximum limits in the
pinch property.

所以你应该能够做到这样的事情:

Camera {
    id: myCamera
}

PinchArea {
    onPinchUpdated: {
        myCamera.fieldOfView = pinch.scale*someFactor
    } 
}

这可以在任何可以访问Pinch和Camera的自定义QML中完成.
如果它是自定义脚本,您可以将alwazs作为属性传递给相机

property Camera myCamera

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读