Sign in to follow this  

babylon viewer

Recommended Posts

Hello guys,

I made a viewer using babylon, my viewer is support .babylon and .obj and everything is good. but i have an issue:

- the babylon file have scale 1 but it so small in scene

- the obj file has the same scale but it so big in scene

I need the same size for all model that i view.

please help

Share this post

Link to post
Share on other sites

The only way you can do it is by creating an invisible mesh parent which will hold the loaded obj models, since there are some obj models out there that contain more that one mesh, and often they do not have the same scaling factor. After that you should set the scaling of each mesh to  :


Here is an example :

var container = BABYLON.Mesh.CreateBox("ObjParent", 1, scene);
container.position = new BABYLON.Vector3(myposZ,myposY,myposZ);
container.rotation = new BABYLON.Vector3(0,0,0);
container.scaling = new BABYLON.Vector3(myscalingX,myscalingY,myscalingZ);

var OBJ = loader.addMeshTask("ObjLoader", "", "", "batman.obj");
OBJ.onSuccess = function (t) {

	t.loadedMeshes.forEach(function (m, i) {
		m.parent = container;
		m.scaling = container.getBoundingInfo().boundingBox.extendSize;
		m.position = new BABYLON.Vector3(0,0,0); // Put at the origin of the parent



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.