You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
`
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.
The text was updated successfully, but these errors were encountered:
Hi! Have you got any progress on your issue? I might faced the same problem.
@parilyak
Hi, unfortunately not. I searched for solution but not found any. I solved it another way according to my requirements.
Anyways I googled it more and found that viroviewscene actually uses surfaceview for 3D rendering.
You can go through this for better understanding.
You cannot place 2 SurfaceViews(SV) into one Activity. For understand why you should know how SVs works.
Environment
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
`
`
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));
`
Reproducible Demo
Just run this code snippet simply creating a project in android studio, you can see that only
viro_scene_right
is loading butviro_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.
The text was updated successfully, but these errors were encountered: