Jump to content

two views of the same model


benoit-1842
 Share

Recommended Posts

Hi everybody....  I have a model that loads perfectly in my browser.  Now I need to duplicate that model because I need a front and side view..  Is it easier to clone the model with animation or to have a separate window you think.... and if it's a separate window how can you do that ?

 

Merci,

 

Benoit

Link to comment
Share on other sites

I guess what you want to use depends on what exactly you want to do with it in the end.

 

About multi views:

http://babylondoc.azurewebsites.net/page.php?p=22461 // offical documentation

http://pixelcodr.com/tutos/shooter/shooter.html // example implementation from the docs where it is used for a mini map

http://www.html5gamedevs.com/topic/5204-a-problem-with-multi-viewport-screen-layout-positions/ // extensive discussion with example :P

http://jsfiddle.net/garidan/zbgkq8nr/6/ // another fiddle I just found that demonstrates the multiple view ports..you can drag the objects to see them move in all view ports

(found in this thread: http://www.html5gamedevs.com/topic/5973-multiple-viewport-issues/page-3)

 

And if that's all too complex to get you started I made a very basic playground example just for you: http://www.babylonjs-playground.com/#W690S :D

Link to comment
Share on other sites

If you want to load just a mesh and not a whole scene you can basically do it like this:

BABYLON.SceneLoader.ImportMesh("spaceship", "Scenes/SpaceDek/", "SpaceDek.babylon", scene, function (newMeshes, particleSystems) {    // do something here as soon as the mesh is loaded});

.... the first parameter here - "spaceship" -  is also the name of the mesh that you want to import in your Blender scene.

 

Source: http://blogs.msdn.com/b/eternalcoding/archive/2013/06/28/babylon-js-how-to-load-a-babylon-file-produced-with-blender.aspx // here is also explained how to load a whole scene and what to look out for

 

If you can't get it to work maybe just try it out at the Babylon Sandbox: http://www.babylonjs.com/sandbox/ If it works there it should work in your code, too, somehow. Let us know if there are problems or something you don't understand. Good luck! :P

Link to comment
Share on other sites

I will give you my .babylon file so you can see if it's working.....  This thing isn't that easy for me !!!!!  But I am learning.... Because my model that I did in Blender run well in the sandbox....  But I am unable to run it in wamp (localhost) with the two viewports....

 

Merci beaucoup,

 

Benoit

 

https://drive.google.com/a/physmodo.com/file/d/0B6PrQ0hnuh0AZFlfNEdHSVZBLUk/view?usp=sharing

Link to comment
Share on other sites

I didn't get a chance to use my PC last night so ... sorry for the delay. I played around with it a bit and I think I got what you want: http://p215008.mittwaldserver.info/viewPorts/

 

It took me a while, too and I can't really tell you what the difference between yours and mine is. You have to compare yourself. I can just tell you what I did to get it working :P

 

The code is actually quite short, so I post it here:

var canvas = document.getElementById("renderCanvas");var engine = new BABYLON.Engine(canvas, true);BABYLON.SceneLoader.Load("", "models/Mannequin6animation.babylon", engine, function (newScene) {    newScene.executeWhenReady(function () {	// Camera 1 (right side)	var camera1 = new BABYLON.ArcRotateCamera("camera1", 0, Math.PI/2, 20, new BABYLON.Vector3(0,7,0), newScene);	newScene.activeCameras.push(camera1);	// Camera 2 (left side)	var camera2 = new BABYLON.ArcRotateCamera("camera2", -Math.PI/2, Math.PI/2, 20, new BABYLON.Vector3(0,7,0), newScene);	newScene.activeCameras.push(camera2);	// Viewports	camera1.viewport = new BABYLON.Viewport(0.5, 0, 0.5, 1.0); // right	camera2.viewport = new BABYLON.Viewport(0.0, 0, 0.5, 1.0); // left	// Camera control	camera2.attachControl(canvas, true);	// Animation	var skeleton = newScene.getSkeletonById(0);	newScene.beginAnimation(skeleton, 1, 50, true, 1);	engine.runRenderLoop(function () {	    newScene.render();        });    });});window.addEventListener("resize", function () { engine.resize();});

I guess there is no big explanation needed. If you have a question about something just ask :D Good luck with it, I hope it will work for you!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...