Jump to content

material change on imported mesh


boris
 Share

Recommended Posts

Hi guys.

i got 2 little questions that are bothering me:

1. im importing an .obj model with assetManager, and onSuccess im trying to iterate through all of the models meshs and change their material texture's to a new texture. but i just does nothing. http://www.babylonjs-playground.com/#2GVUDN .

BUT, if i save the loaded model and create a function that runs after about 15 seconds that tries to do create new textures for all the meshes it does it succefully.

what am i missing here?

 

2. in that same link, how can i prevent the arc camera from going below the house? that means keep it always above 0 (y>0)

 

thanks.

Link to comment
Share on other sites

@boris; Hi boris, welcome to the forum :)

For controlling the ArcRotate camera you can use this kind of code:

myScene.registerBeforeRender(function () {		            
	if (myCamera.beta < .75) myCamera.beta = .75;
	else if (myCamera.beta > (Math.PI / 2) * 0.66) myCamera.beta = (Math.PI / 2) * 0.66;       
});

I got the code originally from something @Dad72 posted.:).  Play around with the beta values to meet your needs.

I have no experience with loading .obj files directly - but others can help I'm sure.

cheers, gryff :)

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...