arFragment.setOnTapArPlaneListener(
(HitResult hitResult, Plane plane, MotionEvent motionEvent) -> {...})我希望将模型锚定到平面上,并使其始终面朝上(天花板):
Anchor anchor = plane.createAnchor(plane.getCenterPose());
AnchorNode anchorNode = new AnchorNode(anchor);
anchorNode.setRenderable(model);问题是模型有时是随机旋转的。有时,它不指向天花板:它被旋转180度、90度或随机旋转。
发布于 2018-09-27 19:20:53
您可以使用类似于
boolean isVerticalPlane = plane.getType() == Plane.Type.VERTICAL;从你的ArFragment进入你的setOnTapArPlaneListener。
最终的代码将是:
ArFragment arFragment = (ArFragment) getSupportFragmentManager().findFragmentById(R.id.ux_fragment);
arFragment.setOnTapArPlaneListener(new BaseArFragment.OnTapArPlaneListener() {
@Override
public void onTapPlane(HitResult hitResult, Plane plane, MotionEvent motionEvent) {
boolean isVerticalPlane = plane.getType() == Plane.Type.VERTICAL;
}
});https://stackoverflow.com/questions/52321266
复制相似问题