我想对我现有的 AR 应用程序做一些修改,我想拆分视图并添加到 2ARSCNView中,这样用户就可以使用 VR Card Box 并获得不同的体验,但 Xcode 总是返回给我:
Session (0x102617d10): did fail with error: Error Domain=com.apple.arkit.error Code=102 "Required sensor failed."
Run Code Online (Sandbox Code Playgroud)
所以,我假设我不能同时运行 2 个ARSCNView会话,还是我错了?
我有以下用于简单倒数计时器的 Kotlin 代码:
val thousand: Long = 1000
val timer = object: CountDownTimer(1800000, 1000) {
override fun onTick(millisUntilFinished: Long) {
var timeResult = millisUntilFinished/thousand
textTimer.text = "$timeResult"
}
override fun onFinish() {
textTimer.text = "Time is out"
}
}
timer.start()
textTimer.text = "$timer"
Run Code Online (Sandbox Code Playgroud)
如何格式化1800 seconds以30 min : 00 sec在科特林?
大家好,我正在尝试解压缩 USDZ 文件,修改纹理,然后再次压缩 USDZ 文件,但它损坏了。
有什么特殊的方法可以将文件压缩回来吗?即使我再次解压缩并压缩它也会停止工作并且文件大小不同。
我没有使用压缩和加密来压缩文件。我注意到的一件事是 USDZ 文件的“需要提取”属性是“2.0 或更高版本”,而我的新 zip 文件值是“1.0 或更高版本”。此外,原始 USDZ zip 中的文件有一些额外的字段,我无法读取或添加到我的新文件中。
可能会发生什么?任何帮助,将不胜感激。
什么是光线投射在ARKit和RealityKit方法?
func raycast(origin: SIMD3<Float>,
direction: SIMD3<Float>,
length: Float = 100,
query: CollisionCastQueryType = .all,
mask: CollisionGroup = .all,
relativeTo referenceEntity: Entity? = nil) -> [CollisionCastHit]
Run Code Online (Sandbox Code Playgroud)
或makeRaycastQuery实例方法:
func makeRaycastQuery(from point: CGPoint,
allowing target: ARRaycastQuery.Target,
alignment: ARRaycastQuery.TargetAlignment) -> ARRaycastQuery?
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏。
我开始使用 ARKit,并且有一个用例,我想知道从一个已知位置到另一个位置的运动。
所以我想知道是否有可能(像每个跟踪解决方案一样)在 ARKit 中设置已知的位置和方向作为跟踪的起点?
问候
我正在 ARCore Android 中工作,我想在单击按钮时旋转 3D 模型。
我已经完成了旋转,但问题是它不会在当前位置旋转,即如果模型移动到平面上的其他位置,它会回到模型投影的初始位置,在这里我们可以看到旋转。我想将我的模型旋转到平面上的任何位置,并且它保留在那里。
这是我的代码
private void rotateRight(TransformableNode node, AxisClass objAxis, Vector3 pos) {
node.getRotationController().setEnabled(true);
node.getScaleController().setEnabled(true);
node.getTranslationController().setEnabled(false);
Quaternion rightMoveVector = new Quaternion();
rightMoveVector = tNode.getLocalRotation();
Quaternion orientations = new Quaternion();
Quaternion orientation = Quaternion.axisAngle(new Vector3(pos.x, 1.0f, pos.z), rotateAngle);
node.setLocalRotation(Quaternion.axisAngle(new Vector3(0.0f, 1.0f, 0.0f), rotateAngle));
rotateAngle = rotateAngle + 30;
objAxis.setRotateRight(String.valueOf(rotateAngle));
objAxis.setY_axis(String.valueOf(Math.toRadians(rotateAngle)));
}
Run Code Online (Sandbox Code Playgroud) 在我之前的问题中,我已经找到了如何仅在对象上的一个轴上进行旋转变换,现在我希望将其设置为动画。
有没有办法在 RealityKit 中做到这一点?
我想使用ARKit和RealityKit检测 2D 图像。我不想使用 SceneKit,因为很多实现都基于 RealityKit。我在 RealityKit 上找不到任何检测图像的示例。我参考了苹果的https://developer.apple.com/documentation/arkit/detecting_images_in_an_ar_experience示例代码。它使用 Scenekit 和ARSCNViewDelegate
let arConfiguration = ARWorldTrackingConfiguration()
arConfiguration.planeDetection = [.vertical, .horizontal]
arConfiguration.isLightEstimationEnabled = true
arConfiguration.environmentTexturing = .automatic
if let referenceImages = ARReferenceImage.referenceImages(inGroupNamed: "sanitzer", bundle: nil) {
arConfiguration.maximumNumberOfTrackedImages = 1
arConfiguration.detectionImages = referenceImages
}
self.session.run(arConfiguration, options: [.resetTracking, .removeExistingAnchors])
Run Code Online (Sandbox Code Playgroud)
我已实施ARSessionDelegate但无法检测图像?
func session(_ session: ARSession, didAdd anchors: [ARAnchor]) {
//how to capture image anchor?
}
func session(_ session: ARSession, didUpdate anchors: [ARAnchor]) {
//how to capture image anchor? …Run Code Online (Sandbox Code Playgroud) 我构建了一个使用图像跟踪和交换平面图像的应用程序。我还使用了人物遮挡(现在),这样人们就可以在这些图像前面拍摄照片。我真的希望这个应用程序有一个自拍模式,这样人们就可以在图像交换区域前拍摄自己的照片。
我正在阅读 ARKit 3.5 上的功能,但据我所知,唯一支持前置摄像头的是ARFaceTrackingConfiguration,它不支持图像跟踪。ARImageTrackingConfiguration并且ARWorldTrackingConfiguration只使用后置摄像头。
有没有办法使用前置摄像头制作带有人物遮挡(和图像跟踪)的自拍模式?
我有一个自定义的 usdz 文件(不是通过代码创建的,但比方说一把真正的椅子!)。我将其保存在Entity.
一旦我有了它,这就是我的代码:
func updateUIView(_ uiView: ARView, context: Context) {
if let modelEntity = model.modelEntity {
print("\(model.modelName)")
let anchorEntity = AnchorEntity(plane: .horizontal)
anchorEntity.addChild(modelEntity.clone(recursive: true))
uiView.scene.addAnchor(anchorEntity)
// modelEntity.generateCollisionShapes(recursive: true)
// If we have multiple object, recursive true help to generate collision for all of them
uiView.installGestures(.rotation, for: modelEntity as! Entity & HasCollision)
uiView.debugOptions = .showPhysics
} else {
print("Unable to load modelEntity for \(model.modelName)")
}
}
Run Code Online (Sandbox Code Playgroud)
这里的问题是“参数类型‘Entity’不符合预期类型‘HasCollision’”。所以我无法添加任何手势。
但我找不到任何有用的资源来实现我的最终目标。有什么建议吗?