- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在 ArFragment 的 Sceneform 上用一些可见的线连接两个 TransformableNode,但不使用 OpenGL 函数。是否可以在 Android 中的 ARCore Java 中的 Sceneform 中的两个 anchor (或节点)之间画一条线?如果可能的话,我该怎么做?
最佳答案
是的,有一种方法可以做到这一点:
private void addLineBetweenHits(HitResult hitResult, Plane plane, MotionEvent motionEvent) {
int val = motionEvent.getActionMasked();
float axisVal = motionEvent.getAxisValue(MotionEvent.AXIS_X, motionEvent.getPointerId(motionEvent.getPointerCount() - 1));
Log.e("Values:", String.valueOf(val) + String.valueOf(axisVal));
Anchor anchor = hitResult.createAnchor();
AnchorNode anchorNode = new AnchorNode(anchor);
if (lastAnchorNode != null) {
anchorNode.setParent(arFragment.getArSceneView().getScene());
Vector3 point1, point2;
point1 = lastAnchorNode.getWorldPosition();
point2 = anchorNode.getWorldPosition();
/*
First, find the vector extending between the two points and define a look rotation
in terms of this Vector.
*/
final Vector3 difference = Vector3.subtract(point1, point2);
final Vector3 directionFromTopToBottom = difference.normalized();
final Quaternion rotationFromAToB =
Quaternion.lookRotation(directionFromTopToBottom, Vector3.up());
MaterialFactory.makeOpaqueWithColor(getApplicationContext(), new Color(0, 255, 244))
.thenAccept(
material -> {
/* Then, create a rectangular prism, using ShapeFactory.makeCube() and use the difference vector
to extend to the necessary length. */
ModelRenderable model = ShapeFactory.makeCube(
new Vector3(.01f, .01f, difference.length()),
Vector3.zero(), material);
/* Last, set the world rotation of the node to the rotation calculated earlier and set the world position to
the midpoint between the given points . */
Node node = new Node();
node.setParent(anchorNode);
node.setRenderable(model);
node.setWorldPosition(Vector3.add(point1, point2).scaled(.5f));
node.setWorldRotation(rotationFromAToB);
}
);
lastAnchorNode = anchorNode;
}
}
关于android - 如何在 ARCore 的 Sceneform 中的两个 anchor 之间画线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51951704/
我正在扩展我非常有限的 ARCore 知识。 我的问题与 this question 相似(但不同) 我想知道我的设备相机节点是否与我的其他节点相交/重叠,但到目前为止我还没有任何运气 我正在尝试这样
我已经使用 SceneView 加载 3D 模型将近一年了,但我一直不明白是什么导致了这种泄漏。我会实现 LeakCanary,但只有这一次泄漏,因为我不知道如何解决这个问题。 但现在我想弄清问题的根
我想更新与每帧更新的 anchor 相关的数据。如何从 ArSceneView 获取每一帧的帧? 最佳答案 ArSceneView 在绘制场景之前更新 ARCore Frame 对象。您可以通过从使用
我使用了 SceneForm SDK 的示例,但是在这个示例中,当我们将对象放在检测到的地板上时,我们不能在墙上移动。如何解决? arFragment.setOnTapArPlaneListener(
private AnchorNode anchorNode; private void removeAnchorNode(Node nodeRemove) { //Remove an
关闭。这个问题需要更多 focused .它目前不接受答案。 想改进这个问题?更新问题,使其仅关注一个问题 editing this post . 2年前关闭。 Improve this questi
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提出有关书籍、工具、软件库等建议的问题。您可以编辑问题,以便可以用事实和引用来回答它。 9 个月
默认情况下,Arcore/Sceneform 使用房间作为 HDR 环境图像。我该如何更换它? Default HDR Room 最佳答案 目前无法设置自己的环境贴图。如果您想跟踪开发,请跟踪此功能请
基于 ARcore 开发指南 ( Lighting Estimation developer guide for Android ),我正在尝试禁用 Scenceform 中的灯光。但什么也没发生。
我在我的应用程序中使用 AR Core 作为 3D 查看器。我没有将 Sceneform 用于 AR 渲染,而是用于渲染 3D 模型。我面临的问题是如何使用滑动手势或触摸事件对模型进行 360 度旋转
我正在构建一个使用 AR 的 Android 应用程序,我正在为此使用 sceneform 包。我显示一个 3D 模型,其 ModelRenderable 是通过从外部 URI 下载相应的 .sfb
我知道 ARCore 尚不支持步行等 3D 动画,但我如何为节点的旋转设置动画? 我知道我可以设置 LocalRotation 或 WorldRotation,但如何以流畅的方式连续制作此动画? 最佳
我添加了一项基于 Google 的 Codelabs 教程 ( https://codelabs.developers.google.com/codelabs/sceneform-intro/inde
ARCore sceneform 示例项目“hellosceneform”很酷并且运行良好。 问题是需要四处移动手机以获得放置 anchor 的表面。太慢了。 我的应用程序不需要任何东西显示在垂直平面
如果我有两个单独的 Sceneform 可变换节点,它们有自己的 AnchorNodes 和 Anchors,我如何将它们“链接”在一起,以便用户的手势(捏合和拖动)对它们产生相同的效果?如果我将它们
我想通过它的置信度值对 PointCloud 进行着色。 首先,我创建了三个 FloatBuffer,我在其中放置基于阈值的单个点。 private FloatBuffer makeFLoatBuff
我一直在努力将垂直放置的 3d 模型 GLB 格式正确放置在垂直表面上。 Just to be clear, I am not referring to the difficulty of ident
我有一种在 AR 环境中构建和生成 3D Assets 的方法。 3D 资源是存储在元数据文件夹中的 .sfb 文件。我的元数据文件夹中有多个 3D 资源,我希望在调用此函数时随机选择一个资源。这是我
我的理解是有几种环境支持 ARCore,Unity 和 Sceneform SDK 是其中的一些选项。 我想知道除了一个在 Java 中,另一个在 C# 中之外,它们之间有什么不同?除了语言偏好之外,
我正在尝试开发一款 AR 应用程序,以帮助视障人士改善他们使用计算机的条件。 我正在研究 AR 如何帮助 HCI 解决视觉障碍问题,因此,该应用程序使用 WebRTC 来使用 Sceneform 在
我是一名优秀的程序员,十分优秀!