google-ar / sceneform-android-sdk

Sceneform SDK for Android
https://developers.google.com/sceneform/develop/
Apache License 2.0
1.23k stars 604 forks source link

Session Anchor functionality malfunction in 1.16.0 #1060

Closed vortice3D closed 4 years ago

vortice3D commented 4 years ago

Hi there:

I've just migrating to 1.16.0 and I find that Session Anchors don't work as pretending.

Let me explain a bit. I have a development when I place an object in a fixed position (same pose in world) throughout the user experience, so I manage it in the usual way:

Vector3 cameraPos = arFragment.getArSceneView().getScene().getCamera().getWorldPosition();
Vector3 cameraForward = arFragment.getArSceneView().getScene().getCamera().getForward();
Vector3 position = Vector3.add(cameraPos, cameraForward.scaled(1.0f));

// Create an ARCore Anchor at the position.
Pose pose = Pose.makeTranslation(position.x, position.y, position.z);
Anchor anchor = arFragment.getArSceneView().getSession().createAnchor(pose);

//parent node attached to session anchor
mNodeAnchor = new AnchorNode(anchor);
mNodeAnchor.setParent(arFragment.getArSceneView().getScene());

//renderable node
TransformableNode nodeModel = new TransformableNode(arFragment.getTransformationSystem());
nodeModel.setRenderable(andyRenderable);
nodeModel.setParent(mNodeAnchor);

Please nore the getSession.createAnchor call. This code is of course an excerpt of the complete "PositionMesh" functional block which as I said works perfectly win 1.15.0 version and previous ones.

Well, this approach works flawless in previous Sceneform versions, but now with 1.16.0, the object is shown as attached to the camera. That is, I can't get away from or closer to it.

The thing is even more strange because when I rotate my device, the object stand still, as pretended and as was it behavior in previous Sceneform versions.

As a resume of the issue, under 1.16.0 version, using a Session Anchor:

Any help with this?

Thanks for your time.

vortice3D commented 4 years ago

Hi there:

Finally, the problem was related with an error of the 3D guy, who exported the assets with bad measurements scale, several orders of magnitude higher that the intended to be used.

I'm closing this issue.