Model is getting rotated on vertical walls. #129
-
I am using ViewRenderable to Display a poster on a Vertical wall. As soon I take the model onto a vertical wall, The model is getting rotated. I want the model to look the same on both the horizontal and vertical plane, |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
@Override
public void onTapPlane(HitResult hitResult, Plane plane, MotionEvent motionEvent) {
// Create the Anchor.
Anchor anchor = hitResult.createAnchor();
AnchorNode anchorNode = new AnchorNode(anchor);
arFragment.getArSceneView().getScene().addChild(anchorNode);
// Create the 3D model
ModelRenderable.builder()
.setSource(this, Uri.parse("model.glb"))
.setIsFilamentGltf(true)
.build()
.thenAccept(andyRenderable-> {
// Parent the 3D model to the anchor
Node andyNode = new Node();
andyNode.setRenderable(andyRenderable);
anchorNode.addChild(andyNode);
// Orient the node to the up if the plane is vertical
if (plane.getType() == Type.VERTICAL) {
Vector3 anchorUp = anchorNode.getUp();
andyNode.setLookDirection(Vector3.up(), anchorUp);
}
});
} More infos: google-ar/sceneform-android-sdk#65 (comment) |
Beta Was this translation helpful? Give feedback.
-
andy is a node or a Renderable model? |
Beta Was this translation helpful? Give feedback.
-
See edited answer |
Beta Was this translation helpful? Give feedback.
-
Please send your questions in the Discussions/Q&A section and mark it as answered when it's the case |
Beta Was this translation helpful? Give feedback.
See edited answer