Artem Posted February 28, 2014 Share Posted February 28, 2014 I've been checking this documentation, but didn't find anything I can use. Please, help. Quote Link to comment Share on other sites More sharing options...
Artem Posted February 28, 2014 Author Share Posted February 28, 2014 Nevermind, I figured it out (silly me). I just used '.scaling.y' to get height.var myMeshHeight = myMesh.scaling.y; Quote Link to comment Share on other sites More sharing options...
gwenael Posted February 28, 2014 Share Posted February 28, 2014 Hmmm, I'm not sure that it is exactly what you want. "scaling.y" is a factor not the final size.You may want to use player.getBoundingInfo().boundingBox which contains size along x,y and z of the box which wrapps the mesh. Where does 1/60 come from? Is it a value which works for your meshes (ground and player) or works for any other ones? JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
Artem Posted February 28, 2014 Author Share Posted February 28, 2014 Hmmm, I'm not sure that it is exactly what you want. "scaling.y" is a factor not the final size.You may want to use player.getBoundingInfo().boundingBox which contains size along x,y and z of the box which wrapps the mesh. Where does 1/60 come from? Is it a value which works for your meshes (ground and player) or works for any other ones? Oh, I need to try it then. Thank you for the tip. 1/60 is my default world timer (fps), I didn't figure out any other ways yet, so I just use 1/60 everywhere where I calculate stuff. I'm new to all this Quote Link to comment Share on other sites More sharing options...
Artem Posted February 28, 2014 Author Share Posted February 28, 2014 I tried it, but 'minimumWorld' and 'maximumWorld' vectors gives all the same numbers as 'scaling' does. Am I doing something wrong? I'm confused. Quote Link to comment Share on other sites More sharing options...
gwenael Posted February 28, 2014 Share Posted February 28, 2014 var vectorsWorld = player.getBoundingInfo().boundingBox.vectorsWorld; // summits of the bounding boxvar d = vectorsWorld[1].subtract(vectorsWorld[0]).length; // distance between summit 0 and summit 1Thus you can get the width, the depth and the height of the bounding box, you just need to modify the indices (1 and 0) in the second expression. The values that you will obtain may be the same than 'scaling' BUT it will only be a special case I think. You can replace all your 1/60 by 1/BABYLON.Tools.GetFps() Artem 1 Quote Link to comment Share on other sites More sharing options...
Artem Posted February 28, 2014 Author Share Posted February 28, 2014 Ah, I think I got it now. Thanks a lot for information, gwenael! Also, thanks a lot for 'BABYLON.Tools.GetFps()', that's the thing I was looking for as well. Quote Link to comment Share on other sites More sharing options...
gwenael Posted February 28, 2014 Share Posted February 28, 2014 My pleasure. Quote Link to comment Share on other sites More sharing options...
Artem Posted February 28, 2014 Author Share Posted February 28, 2014 Tested it. It really works just like 'scaling' thing (at least it looks all the same in game), but I feel that 'getBoundingInfo' method is much more accurate than 'scaling' one. Much more stuff to play with too Thanks once again for your help, gwenael ♥ gwenael 1 Quote Link to comment Share on other sites More sharing options...
Lugtigheid Posted March 1, 2017 Share Posted March 1, 2017 This worked for me... var vectorsWorld = YOURMESH.getBoundingInfo().boundingBox.vectorsWorld; width = Number(vectorsWorld[1].x-(vectorsWorld[0].x)) JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
AnnaBruel Posted March 19, 2018 Share Posted March 19, 2018 Maybe, this way: width = mesh.geometry.extend.maximum.x-mesh.geometry.extend.minimum.x JackFalcon 1 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.