我正在尝试放置一个锚点,并在用户触摸屏幕的位置显示它,以返回X和Y坐标。
tapX = tap.getX();
tapY = tap.getY();
我希望使用这些信息创建一个矩阵来支持我的模型。也就是说,把我的3D模型放在用户点击的位置。
目前我尝试了:
float sceneX = (tap.getX()/mSurfaceView.getMeasuredWidth())*2.0f - 1.0f;
float sceneY = (tap.getY()/mSurfaceView.getMeasuredHeight())*-2.0f + 1.0f; //if bottom is at -1. Otherwise same as X
Pose temp = frame.getPose().compose(Pose.makeTranslation(sceneX, sceneY, -1.0f)).extractTranslation();
目前我只是将3D对象放在距离摄像机1米的位置。但我无法得到正确的位置。
有没有一种方法可以将局部坐标转换为世界坐标?