text: [{"Owner":"dav74","Date":"2013-12-15T12:34:38Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_Hi_co__lt_/p_gt__lt_p_gt_I_t_m trying inhritance (object-oriented programming) with babylonJS (for teaching it to my _qt_advanced_qt_ students) _dd__lt_/p_gt__lt_pre class_eq__qt_ipsCode prettyprint_qt__gt_var canvas _eq_ document.getElementById(_qt_renderCanvas_qt_)_sm_var time_eq_0_sm_var tabEnnemi_eq_[]_sm_var engine _eq_ new BABYLON.Engine(canvas_co_ true)_sm_ var scene _eq_ new BABYLON.Scene(engine)_sm_var camera _eq_ new BABYLON.ArcRotateCamera(_qt_cam_qt__co_ Math.PI/2_co_ 0_co_ 50_co_ new BABYLON.Vector3(0_co_0_co_0)_co_ scene)_sm_camera.attachControl(canvas)_sm_var light _eq_ new BABYLON.PointLight(_qt_pointLumineux1_qt__co_ new BABYLON.Vector3(100_co_ 100_co_ 0)_co_ scene)_sm_ var plan_eq_BABYLON.Mesh.CreatePlane(_qt_sol_qt__co_200_co_scene)_sm_plan.rotation.x_eq_Math.PI/2_sm_//class Ennemifunction Ennemi(pt_vie_co_i){\tBABYLON.Mesh.CreateSphere.call(this_co__qt_ennemi_qt_+i_co_20_co_1_co_scene)\tthis.pt_vie_eq_pt_vie_sm_}Ennemi.prototype_eq_Object.create(BABYLON.Mesh.prototype)//fin Class Ennemifor (var i_eq_0_sm_i&lt_sm_2_sm_i++){\te_eq_new Ennemi(5_co_i)_sm_\tconsole.log(e.isVisible)_sm_\tconsole.log(e.position)_sm_\ttabEnnemi.push(e)_sm_}scene.registerBeforeRender(function(){\ttime_eq_time+(1/BABYLON.Tools.GetFps())_sm_})_sm_engine.runRenderLoop(function () {     scene.render()_sm_ })_sm__lt_/pre_gt__lt_p_gt_All is ok for _qt_isVisible_qt_ but i_t_ve _qt_undifined_qt_ with _qt_position_qt_ (console.log(e.isVisible) and console.log(e.position))_lt_/p_gt__lt_p_gt_What is wrong in my inheritance ?_lt_/p_gt__lt_p_gt_(I_t_ve take a look on file _qt_babylon.mesh.js_qt_ (GitHub)_co_but....i didn_t_t find solution)_lt_/p_gt__lt_p_gt_thank you for your help_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Deltakosh","Date":"2013-12-15T17:25:43Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_If you want to inherit from mesh you have to do that_dd__lt_/p_gt__lt_p_gt__lt_span style_eq__qt_color_dd_rgb(0_co_0_co_136)_sm__qt__gt_function_lt_/span_gt__lt_span_gt_ _lt_/span_gt__lt_span style_eq__qt_color_dd_rgb(102_co_0_co_102)_sm__qt__gt_Ennemi_lt_/span_gt__lt_span style_eq__qt_color_dd_rgb(102_co_102_co_0)_sm__qt__gt_(_lt_/span_gt__lt_span_gt_pt_vie_lt_/span_gt__lt_span style_eq__qt_color_dd_rgb(102_co_102_co_0)_sm__qt__gt__co__lt_/span_gt__lt_span_gt_i_lt_/span_gt__lt_span style_eq__qt_color_dd_rgb(102_co_102_co_0)_sm__qt__gt_){_lt_/span_gt__lt_br_gt__lt_span_gt_    BABYLON_lt_/span_gt__lt_span style_eq__qt_color_dd_rgb(102_co_102_co_0)_sm__qt__gt_._lt_/span_gt__lt_span style_eq__qt_color_dd_rgb(102_co_0_co_102)_sm__qt__gt_Mesh_lt_/span_gt__lt_span style_eq__qt_color_dd_rgb(102_co_102_co_0)_sm__qt__gt_._lt_/span_gt__lt_span_gt_call_lt_/span_gt__lt_span style_eq__qt_color_dd_rgb(102_co_102_co_0)_sm__qt__gt_(_lt_/span_gt__lt_span style_eq__qt_color_dd_rgb(0_co_0_co_136)_sm__qt__gt_this_lt_/span_gt__lt_span style_eq__qt_color_dd_rgb(102_co_102_co_0)_sm__qt__gt__co__lt_/span_gt__lt_span style_eq__qt_color_dd_rgb(0_co_136_co_0)_sm__qt__gt__qt_ennemi_qt__lt_/span_gt__lt_span style_eq__qt_color_dd_rgb(102_co_102_co_0)_sm__qt__gt_+_lt_/span_gt__lt_span_gt_i_lt_/span_gt__lt_span style_eq__qt_color_dd_rgb(102_co_102_co_0)_sm__qt__gt__co__lt_/span_gt__lt_span_gt_scene_lt_/span_gt__lt_span style_eq__qt_color_dd_rgb(102_co_102_co_0)_sm__qt__gt_)_lt_/span_gt__lt_br_gt__lt_span_gt_    _lt_/span_gt__lt_span style_eq__qt_color_dd_rgb(0_co_0_co_136)_sm__qt__gt_this_lt_/span_gt__lt_span style_eq__qt_color_dd_rgb(102_co_102_co_0)_sm__qt__gt_._lt_/span_gt__lt_span_gt_pt_vie_lt_/span_gt__lt_span style_eq__qt_color_dd_rgb(102_co_102_co_0)_sm__qt__gt__eq__lt_/span_gt__lt_span_gt_pt_vie_lt_/span_gt__lt_span style_eq__qt_color_dd_rgb(102_co_102_co_0)_sm__qt__gt__sm__lt_/span_gt__lt_br_gt__lt_span style_eq__qt_color_dd_rgb(102_co_102_co_0)_sm__qt__gt_}_lt_/span_gt__lt_/p_gt__lt_p_gt_ _lt_/p_gt__lt_p_gt__lt_span style_eq__qt_color_dd_rgb(102_co_102_co_0)_sm__qt__gt_the CreateMesh function is a _qt_static function_qt_ so that you cannot call it like an _qt_instance_qt_ method_lt_/span_gt__lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"dav74","Date":"2013-12-15T17:42:37Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_ok thank you for your answer_lt_/p_gt__lt_p_gt_Where can i use the _qt_static function_qt_ CreateSphere ? in my constructor _qt_Ennemi_qt_ ? is it possible ?_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Deltakosh","Date":"2013-12-15T19:00:32Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_Alas no_co_ and this is the same thing as Object oriented language (like C++ or C#)._lt_/p_gt__lt_p_gt_CreateSphere is static and returns a mesh. It does not update the _t_this_t_ value_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"dav74","Date":"2013-12-15T20:29:23Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_ok thank you_lt_/p_gt__lt_p_gt_i found another way_co_ is it the _qt_best_qt_ solution ???_lt_/p_gt__lt_pre class_eq__qt_ipsCode prettyprint_qt__gt_var canvas _eq_ document.getElementById(_qt_renderCanvas_qt_)_sm_var time_eq_0_sm_var tabSph_eq_[]var tabEnnemi_eq_[]_sm_var nbrEn_eq_5var engine _eq_ new BABYLON.Engine(canvas_co_ true)_sm_ var scene _eq_ new BABYLON.Scene(engine)_sm_var camera _eq_ new BABYLON.ArcRotateCamera(_qt_cam_qt__co_ Math.PI/2_co_ 1.5*Math.PI/4_co_ 50_co_ new BABYLON.Vector3(0_co_0_co_0)_co_ scene)_sm_camera.attachControl(canvas)_sm_var light _eq_ new BABYLON.PointLight(_qt_pointLumineux1_qt__co_ new BABYLON.Vector3(100_co_ 100_co_ 0)_co_ scene)_sm_ var plan_eq_BABYLON.Mesh.CreatePlane(_qt_sol_qt__co_200_co_scene)_sm_plan.rotation.x_eq_Math.PI/2_sm_for (var i_eq_0_sm_i&lt_sm_nbrEn_sm_i++){\ttabSph.push(BABYLON.Mesh.CreateSphere(_qt_sph_qt_+i_co_20_co_2_co_scene))_sm_}function Ennemi(ptsVie_co_posX_co_posY_co_posZ){\tthis.ptsVie_eq_ptsVie_sm_\tthis.posX_eq_posX_sm_\tthis.posY_eq_posY_sm_\tthis.posZ_eq_posZ_sm_\tthis.vitesse_eq_0.1*Math.random()+0.2_sm_}Ennemi.prototype.NouvPos_eq_function(i){\ttabSph[i].position.x_eq_this.posX_sm_\ttabSph[i].position.y_eq_this.posY_sm_\ttabSph[i].position.z_eq_this.posZ_sm_}Ennemi.prototype.deplaEn_eq_function(){\tif (this.posY&lt_sm_2 || this.posY&gt_sm_15){\t\tthis.vitesse_eq_-this.vitesse\t}\tthis.posY_eq_this.posY+this.vitesse}for (var i_eq_0_sm_i&lt_sm_nbrEn_sm_i++){\ttabEnnemi.push(new Ennemi(5_co_6*i_co_5_co_0))_sm_}scene.registerBeforeRender(function(){\ttime_eq_time+(1/BABYLON.Tools.GetFps())_sm_\tfor (var i_eq_0_sm_i&lt_sm_nbrEn_sm_i++){\t\ttabEnnemi[i].NouvPos(i)_sm_\t\ttabEnnemi[i].deplaEn()_sm_\t}})_sm_engine.runRenderLoop(function () {     scene.render()_sm_ })_sm__lt_/pre_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Deltakosh","Date":"2013-12-16T07:22:32Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_This works but there is no inheritance here_lt_/p_gt__lt_p_gt_A good example of inheritance can be found in this article (when you create custom material)_dd__lt_/p_gt__lt_p_gt__lt_a href_eq__qt_http_dd_//blogs.msdn.com/b/eternalcoding/archive/2013/08/06/babylon-js-creating-a-convincing-world-for-your-game-with-custom-shaders-height-maps-and-skyboxes.aspx_qt_ rel_eq__qt_external nofollow_qt__gt_http_dd_//blogs.msdn.com/b/eternalcoding/archive/2013/08/06/babylon-js-creating-a-convincing-world-for-your-game-with-custom-shaders-height-maps-and-skyboxes.aspx_lt_/a_gt__lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"dav74","Date":"2013-12-16T10:17:35Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_thank you for your answer_co_ the inheritance will be in the next example (work in progress) _sm_-)_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"}]