Gutgiut Posted November 23, 2018 Share Posted November 23, 2018 Hi, I'm starting programming with BABYLONJS and loving it. I've watched MVA - Babylonjs course and have a question, how can you load a mesh and add to it a boundingbox so you can get it's size and also control colisions My code looks like this: // load mesh engine.displayLoadingUI(); BABYLON.SceneLoader.ImportMesh("", "models/motor_boat/", "motor_boat.babylon", scene, function (yacht) { engine.hideLoadingUI(); yacht[0].name = "boat"; // boat dimentions var size = yacht[0].getBoundingInfo().boundingBox.vectors.extendSize; console.log(size); }); console prints undefined What am I doing wrong? Tks Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 23, 2018 Share Posted November 23, 2018 getBoundingInfo does not account for children. You might need to rely on getHierarchyBoundingVectors in your case, I suspect that boat is having children. Quote Link to comment Share on other sites More sharing options...
Gutgiut Posted November 23, 2018 Author Share Posted November 23, 2018 3 hours ago, Sebavan said: getBoundingInfo does not account for children. You might need to rely on getHierarchyBoundingVectors in your case, I suspect that boat is having children. Hi Sebavan, Thanks for your answer. This is what I was looking for. 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.