开发者社区> 问答> 正文

在图像检测应用程序上使用手势旋转3D模型

我正在研究图像检测android应用程序。

我已经成功检测到图像并针对该图像显示了模型,但是存在以下问题。

当我使用Surface Detection android app时,我使用Arfragments了Quaternion对象,然后使用了transformable函数来旋转模型。

但是知道我使用的是ArSceneView我编写的这段代码,但是当图像检测后显示模型时,它使用SceneForm以90度角显示我的模型。

我希望当用户单击模型时它将旋转。你能帮我吗?

提前致谢。

Node node = new Node();       
    Pose pose =Pose.makeTranslation(0.0f,0.0f,0.25f);
    node.setParent(this);
    node.setLocalPosition(new Vector3(pose.tx(),pose.ty(),pose.ty()));
    node.setLocalRotation(new Quaternion(pose.qx(),pose.qy(),pose.qz(),pose.qw())); 
    if(node!= null)
    {
    Quaternion rotation1 = Quaternion.axisAngle(new Vector3(1.0f, 0.0f, 0.0f), 90); // rotate X axis 90 degrees
    Quaternion rotation2 = Quaternion.axisAngle(new Vector3(0.0f, 1.0f, 0.0f), 90); // rotate Y axis 90 degrees
    node.setLocalRotation(Quaternion.multiply(rotation1, rotation2));
    }

展开
收起
垚tutu 2019-11-28 22:38:05 746 0
0 条回答
写回答
取消 提交回答
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
复杂环境下的视觉同时定位与地图构建 立即下载
《EdgeRoutine 边缘程序》 立即下载
营销设计场景下的图像和文字生成 立即下载