syed samoon Posted November 25, 2017 Share Posted November 25, 2017 Hi, i need a help, how to access the mesh properties from another function code is below... it show Uncaught TypeError: Cannot read property 'position' of undefined how to fix it BABYLON.SceneLoader.ImportMesh("", "scenes/", "a44.babylon", scene, function (newMeshes) { player = scene.getMeshByName("Character"); } console.log(player.position); Quote Link to comment Share on other sites More sharing options...
Arte Posted November 25, 2017 Share Posted November 25, 2017 Hi @syed samoon player = newMeshes[0]; Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 25, 2017 Share Posted November 25, 2017 https://www.babylonjs-playground.com/#10D6YT#52 You can but need to check the mesh is not null because it is asynchronous. It is what you asked on the other thread with the same question: Quote Link to comment Share on other sites More sharing options...
syed samoon Posted November 27, 2017 Author Share Posted November 27, 2017 On 11/26/2017 at 12:34 AM, Sebavan said: https://www.babylonjs-playground.com/#10D6YT#52 You can but need to check the mesh is not null because it is asynchronous. It is what you asked on the other thread with the same question: Thanks Dude. it is working Quote Link to comment Share on other sites More sharing options...
syed samoon Posted November 27, 2017 Author Share Posted November 27, 2017 On 11/25/2017 at 4:15 PM, Arte said: Hi @syed samoon player = newMeshes[0]; it is also fine with getMeshByName("mesh_name"); 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.