Richard C Posted September 13, 2016 Share Posted September 13, 2016 Can anyone help with this problem please. I have a model developed in Blender which is exported into Babylon. The model is good and imports well (with many thanks to Gryff). However, I wish to add a water plane using waterMaterial.js and weird things happen. I have used a coloured/textured cube as an example in the following four images. WMCode.jpg, ie the entire code for the page With out the reference to waterMaterial.js the result is the cube NoWM.jpg - as it should be, ie materials on 5 sides of the cube and a texture image on the top but of course no water plane If I add waterMaterial.js reference 3rd in the list the result is WM3rd.jpg - ie the cube with the texture image on top but the standard material colours absent If I reference waterMaterial.js 1st in the list the result is WM !st.jpg - is a blank white screen with console log error messages as shown. Any ideas anyone please? Thanks Richard C. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted September 13, 2016 Share Posted September 13, 2016 The order of listing js files is important. waterMaterial.js "subclasses" BABYLON.Material. It doesn't really (Javascript is crap). It just runs this function called __extends which copies all the properties from the "super" or base class. BABYLON.Material must be put before waterMaterial.js. I have found as with most other languages, the most important error is the first one. They will all probably go away when the first is fixed. Quote Link to comment Share on other sites More sharing options...
Richard C Posted September 13, 2016 Author Share Posted September 13, 2016 JC -thanks so much for your prompt reply. Regrettably, I'm not sure I fully understand. Is there a separate Babylon.Material script to be included in the references and if so, where do I find it. I have checked the source files from the BABYLON download and can't see a script named BABYLON.Material. Or do I have the wrong end of the stick here!! Thanks again Richard C EDIT: Sorry JC. Ignore this reply I found the script and it appears to work all OK. Thanks again. RC Quote Link to comment Share on other sites More sharing options...
Wingnut Posted September 13, 2016 Share Posted September 13, 2016 Hi RC! This is a bit off-topic, but I was concerned with the e.Gampads is not a constructor error I saw in your pictures. I think this was an error found in some "interim" release of the framework, and has since been fixed. I know I saw it happen in playground demos for a day or two (about 2 weeks ago), and then it went away. So... just possibly, you should get a really fresh version of the framework, and clear your browser cache of any older versions. No promises... just... worth a try... if you are getting that error. Be well. Quote Link to comment Share on other sites More sharing options...
Richard C Posted September 14, 2016 Author Share Posted September 14, 2016 Wingnut - thanks for the heads up. The version used is the latest I believe but I shall check it out. RC Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.