如何在Arcore和casteform中翻译对象



i使用Arcore和SceneForm在Android上构建AR应用程序,当用户单击按钮时,我想在xyz轴上翻译对象。

我该怎么做?

我尝试做到这一点,当用户按按钮时,我会用翻译姿势组成对象姿势,删除对象并用翻译创建新的对象。但是经过一些点击之后,我有了SIG 9(杀死应用程序)。

有其他方式吗?

您可以使用按钮和以下方法在两个锚点之间翻译3D对象。

用于将对象沿表面转换,您应该使用其有用的公共方法,例如:

  • OnDown(MotionEvent E)
  • onfling(MotionEvent E1,MotionEvent E2,float velocityx,float Velocityy)
  • onlongpress(MotionEvent e)
  • onscroll(MotionEvent E1,MotionEvent E2,float Dancex,float Dance)
  • onshowpress(MotionEvent E)
  • onsingletapup(MotionEvent e)

这是如何在onScroll()方法中重绘对象的一个示例:

android.view.GestureDetector.OnGestureListener
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distX, float distY) {
   if (ptrCount < 2) {
       queuedSingleTaps.offer(motionEvent);
       return true;
   } else {
       return false;
   }
}

希望这会有所帮助。

最新更新