- 
                Notifications
    
You must be signed in to change notification settings  - Fork 109
 
Description
Environment
- OS: Windows
 - Version: ViroCore version 1.17.0
 - Device(s): Any device
 
Description
I am using this library to show some animated models using vrx data without AR/VR. For requirement I need to have multiple ViroViewScene instance in a single xml layout. But when two or more ViroViewScene are loaded only the last ViroViewScene in the hierarchy shows the models, others remain blank.
I'm sharing code snippet to what I'm doing
`
<com.viro.core.ViroViewScene
    android:id="@+id/viro_scene_left"
    android:layout_width="match_parent"
    android:layout_height="200dp"/>
<com.viro.core.ViroViewScene
    android:id="@+id/viro_scene_right"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:layout_marginTop="15dp"
    android:layout_below="@+id/viro_scene_left"/>
`
This is the java file in where I'm trying to load models
create3DSceneRight(); create3DSceneLeft();
`    private void create3DSceneRight() {
Scene scene = new Scene();
Node rootNode = scene.getRootNode();
rootNode.setPosition(new Vector(0, 0, 0));
    final Object3D model = new Object3D();
    model.loadModel(mViroViewRight.getViroContext(), Uri.parse("file:///android_asset/vrx_models_2/walking02.vrx"), Object3D.Type.FBX, new AsyncObject3DListener() {
        public void onObject3DFailed(String error) {
            Log.e("TAG_Bottom_right", "Failed to load the model");
        }
        public void onObject3DLoaded(Object3D object, Object3D.Type type) {
            Log.e("TAG_Bottom_Right", "Successfully loaded the model!");
        }
    });
    if (ambient == null) {
        ambient = new AmbientLight(Color.WHITE, 1000.0f);
        rootNode.addLight(ambient);
    }
    model.setPosition(new Vector(0, 0, 0));
    Node cameraNode = new Node();
    Camera camera = new Camera();
    camera.setRotationType(Camera.RotationType.STANDARD);
    cameraNode.setPosition(new Vector(0, 150, 500));
    cameraNode.setCamera(camera);
    rootNode.addChildNode(cameraNode);
    rootNode.addChildNode(model);
    mViroViewRight.setScene(scene);
    mViroViewRight.setPointOfView(cameraNode);
    mViroViewRight.setDebug(true);
}
private void create3DSceneLeft() {
    Scene scene = new Scene();
    Node rootNode = scene.getRootNode();
    rootNode.setPosition(new Vector(0, 0, 0));
    final Object3D model = new Object3D();
    model.loadModel(mViroViewLeft.getViroContext(), Uri.parse("file:///android_asset/vrx_models_3/gym.vrx"), Object3D.Type.FBX, new AsyncObject3DListener() {
        public void onObject3DFailed(String error) {
            Log.e("TAG", "Failed to load the model");
        }
        public void onObject3DLoaded(Object3D object, Object3D.Type type) {
            Log.e("TAG", "Successfully loaded the model!");
        }
    });
    if (ambient == null) {
        ambient = new AmbientLight(Color.WHITE, 1000.0f);
        rootNode.addLight(ambient);
    }
    model.setPosition(new Vector(0, 0, 0));
    Node cameraNode = new Node();
    Camera camera = new Camera();
    camera.setRotationType(Camera.RotationType.STANDARD);
    cameraNode.setPosition(new Vector(0, 150, 500));
    cameraNode.setCamera(camera);
    rootNode.addChildNode(cameraNode);
    rootNode.addChildNode(model);
    mViroViewLeft.setScene(scene);
    mViroViewLeft.setPointOfView(cameraNode);
}
`
Reproducible Demo
Just run this code snippet simply creating a project in android studio, you can see that only viro_scene_right is loading but viro_scene_left is not loading at all.
Can anyone give or suggest me any solution or a path to solution how can I achieve this? Thanks in advance.