简体   繁体   中英

Adding text to a 3d model using sceneform arcore android

I am trying to build a app using arcore and sceneform. For that I want to add text to a 3d model. The text should appear in a particular position in the model.Is that possible using sceneform?

Can anyone give suggestion as to how to proceed?

Text can be added using ViewRenderable , worked with filament version 1.7.0, crashes in some lower versions

Reference

Node tigerTitleNode = new Node();
      tigerTitleNode.setParent(model);
      tigerTitleNode.setEnabled(false);
      tigerTitleNode.setLocalPosition(new Vector3(0.0f, 1.0f, 0.0f));
      ViewRenderable.builder()
              .setView(this, R.layout.tiger_card_view)
              .build()
              .thenAccept(
                      (renderable) -> {
                          tigerTitleNode.setRenderable(renderable);
                          tigerTitleNode.setEnabled(true);
                      })
              .exceptionally(
                      (throwable) -> {
                          throw new AssertionError("Could not load card view.", throwable);
                      }
              );
    });

tiger_card_view.xml

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="@drawable/rounded_bg"
    android:gravity="center"
    android:orientation="vertical"
    android:padding="6dp"
    android:text="Tiger"
    android:textAlignment="center" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM