bestog Posted April 25, 2018 Share Posted April 25, 2018 Hello there, i would like to use the babylonjs package in my JS project. If I do this with my import statement, everything goes. I then call a function in another file and want to assign a new standard material to the object (I pass scene to the function). But now he tells me "this.getScene is not a function". Can it be because this package is not designed for webpack+js+module? Uncaught (in promise) TypeError: this.getScene is not a function Quote Link to comment Share on other sites More sharing options...
royibernthal Posted April 25, 2018 Share Posted April 25, 2018 Can you show us the code? GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
bestog Posted April 25, 2018 Author Share Posted April 25, 2018 @royibernthal objects.js import {Color3, SceneLoader, StandardMaterial, Vector3} from 'babylonjs' import Material from './material' const {ImportMeshAsync} = SceneLoader const Objects = { loadMesh: async (scene, object) => { const result = await ImportMeshAsync('', URL + object.object_id + '/', 'mesh.babylon', scene) const meshes = result.meshes ... console.log('load-Material') await Material.loadMaterial(scene, object.set, meshes[0]) console.log('load finish') } } export default Objects materials.js import {StandardMaterial, Vector2, Vector3, Vector4, Color3, Texture} from 'babylonjs' const Material = { loadMaterial: async (scene, material, mesh) => { var mMaterial = StandardMaterial('material.' + material.id, scene) .... mesh.material = mMaterial } } export default Material 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.