尝试移动Node后Arcore应用程序崩溃

时间:2019-03-10 01:04:08

标签: java android arcore

我正在尝试扩展TransformableNode,因此可以将其锚定到检测到的图像并旋转/更改大小。到目前为止,这两个功能都可以正常工作,但是每当我拖动节点并将其移动到任何地方(甚至一点)时,我都会遇到崩溃。 这是我创建具有图像锚点的可变形节点的方法:

AnchorNode aNode;
TransformableNode tNode;
aNode = new AnchorNode(image.createAnchor(image.getCenterPose()));
aNode.setParent(this);
tNode = new TransformableNode(transSystem);
tNode.setParent(aNode);

这是我得到的崩溃报告: E/InputEventReceiver: Exception dispatching input event. E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback E/MessageQueue-JNI: java.lang.IllegalStateException: TransformableNode must have an AnchorNode as a parent. at com.google.ar.sceneform.ux.TranslationController.getAnchorNodeOrDie(TranslationController.java:209) at com.google.ar.sceneform.ux.TranslationController.onEndTransformation(TranslationController.java:169) at com.google.ar.sceneform.ux.TranslationController.onEndTransformation(TranslationController.java:44) at com.google.ar.sceneform.ux.BaseTransformationController.onFinished(BaseTransformationController.java:117) at com.google.ar.sceneform.ux.BaseGesture.dispatchFinishedEvent(BaseGesture.java:136) at com.google.ar.sceneform.ux.BaseGesture.complete(BaseGesture.java:118) at com.google.ar.sceneform.ux.DragGesture.updateGesture(DragGesture.java:125) at com.google.ar.sceneform.ux.BaseGesture.onTouch(BaseGesture.java:92) at com.google.ar.sceneform.ux.BaseGestureRecognizer.onTouch(BaseGestureRecognizer.java:67) at com.google.ar.sceneform.ux.TransformationSystem.onTouch(TransformationSystem.java:160) at com.google.ar.sceneform.ux.BaseArFragment.onPeekTouch(BaseArFragment.java:424) at com.google.ar.sceneform.TouchEventSystem.onTouchEvent(Unknown Source:39) at com.google.ar.sceneform.Scene.onTouchEvent(Unknown Source:11) at com.google.ar.sceneform.SceneView.onTouchEvent(Unknown Source:9) at android.view.View.dispatchTouchEvent(View.java:12615) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:541) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1893) at android.app.Activity.dispatchTouchEvent(Activity.java:3572) at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:68) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:490) at android.view.View.dispatchPointerEvent(View.java:12860) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5767) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5533) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4987) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5040) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5006) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5160) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5014) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5217) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4987) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5040) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5006) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5014) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4987) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7794) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7759) at android.view.ViewRootImpl.enqueueInpu D/AndroidRuntime: Shutting down VM E/AndroidRuntime: FATAL EXCEPTION: main Process: com.google.ar.sceneform.samples.augmentedimage, PID: 7514 java.lang.IllegalStateException: TransformableNode must have an AnchorNode as a parent. at com.google.ar.sceneform.ux.TranslationController.getAnchorNodeOrDie(TranslationController.java:209) at com.google.ar.sceneform.ux.TranslationController.onEndTransformation(TranslationController.java:169) at com.google.ar.sceneform.ux.TranslationController.onEndTransformation(TranslationController.java:44) at com.google.ar.sceneform.ux.BaseTransformationController.onFinished(BaseTransformationController.java:117) at com.google.ar.sceneform.ux.BaseGesture.dispatchFinishedEvent(BaseGesture.java:136) at com.google.ar.sceneform.ux.BaseGesture.complete(BaseGesture.java:118) at com.google.ar.sceneform.ux.DragGesture.updateGesture(DragGesture.java:125) at com.google.ar.sceneform.ux.BaseGesture.onTouch(BaseGesture.java:92) at com.google.ar.sceneform.ux.BaseGestureRecognizer.onTouch(BaseGestureRecognizer.java:67) at com.google.ar.sceneform.ux.TransformationSystem.onTouch(TransformationSystem.java:160) at com.google.ar.sceneform.ux.BaseArFragment.onPeekTouch(BaseArFragment.java:424) at com.google.ar.sceneform.TouchEventSystem.onTouchEvent(Unknown Source:39) at com.google.ar.sceneform.Scene.onTouchEvent(Unknown Source:11) at com.google.ar.sceneform.SceneView.onTouchEvent(Unknown Source:9) at android.view.View.dispatchTouchEvent(View.java:12615) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:541) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1893) at android.app.Activity.dispatchTouchEvent(Activity.java:3572) at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:68) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:490) at android.view.View.dispatchPointerEvent(View.java:12860) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5767) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5533) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4987) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5040) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5006) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5160) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5014) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5217) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4987) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5040) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5006) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5014) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4987) E/AndroidRuntime: at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7794) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7759) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7717) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7986) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:202) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:386) at android.os.Looper.loop(Looper.java:169) at android.app.ActivityThread.main(ActivityThread.java:7470) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958) I/Process: Sending signal. PID: 7514 SIG: 9 Application terminated.

据我所知,我将节点移动到一个新位置,而不给它新的锚点。如果我是正确的,那么我的问题是如何更改某些Event方法或实现,以便我的应用不会崩溃? (我不介意摆脱拖动节点tbh)。

0 个答案:

没有答案