`我想在不点击的情况下在 ARCore 相机框架中显示箭头。
下面是我的代码片段。
在 Google 示例中,它与 Tap 配合使用。 https://github.com/google-ar/arcore-android-sdk/tree/master/samples/shared_camera_java
请有人帮助我。
public ColoredAnchor(Anchor a, float[] color4f) { this.anchor = a; this.color = color4f; }
private final ArrayList<ColoredAnchor> anchorsIcons = new ArrayList<>();
`private void sampleAnchor() { float[] translationPos = {0.8443243f, 4.5721757f, -0.53583264f}; 浮动 [] 旋转 = { 0, 0, 0, 1 };
Pose pose = new Pose(translationPos, rotation);
Anchor myAnchor = sharedSession.createAnchor(pose);
float[] objColor= new float[] {139.0f, 195.0f, 74.0f, 255.0f};
anchorsIcons.add(new ColoredAnchor(myAnchor, objColor));
}`
private void onDrawFrameCore() {
for (ColoredAnchor coloredAnchor : anchorsIcons) {
// Get the current pose of an Anchor in world space. The Anchor pose is updated
// during calls to sharedSession.update() as ARCore refines its estimate of the world.
coloredAnchor.anchor.getPose().toMatrix(anchorMatrix, 0);
// Update and draw the model and its shadow.
virtualObject.updateModelMatrix(anchorMatrix, scaleFactor);
virtualObjectShadow.updateModelMatrix(anchorMatrix, scaleFactor);
virtualObject.draw(viewmtx, projmtx, colorCorrectionRgba, coloredAnchor.color);
virtualObjectShadow.draw(viewmtx, projmtx, colorCorrectionRgba, coloredAnchor.color);
}
}