Jump to content

watertMaterial.js


Richard C
 Share

Recommended Posts

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.

 

WMCode.JPG

NoWM.JPG

WM3rd.JPG

WM 1st.JPG

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

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