digitspro Posted January 12, 2017 Share Posted January 12, 2017 Hi, Why is it that when I have a mesh disabled (i.e. mesh.setEnabled(false)) any intersectsMesh by it or against it returns true? Setting the method's second parameter 'precise' to true does not help. This output seems counter intuitive and I do not believe it is what anyone would expect. In fact, my intuitive expectation is that by having the mesh disabled, any intersectsMesh on it or against it should return false (even if the mesh being tested with it is in the same position that it would appear in if enabled). What do you think? Playground showing the problem (watch out for the browser console which prints the result of the intersectsMesh method testing two exclusive spheres in position which one of them is disabled): http://www.babylonjs-playground.com/#PD7PP#0 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 12, 2017 Share Posted January 12, 2017 Hi! intersectsMesh does not take in account any scene or visual parameters. It just checks if two meshes intersect. It is the responsibility of the caller to evaluate additional meshes properties prior to calling intersectMesh. Quote Link to comment Share on other sites More sharing options...
digitspro Posted January 12, 2017 Author Share Posted January 12, 2017 4 hours ago, Deltakosh said: Hi! intersectsMesh does not take in account any scene or visual parameters. It just checks if two meshes intersect. Thanks for the reply. Fair enough, but even with this consideration, intersectsMesh is not behaving as expected; In this case, I would not expect intersectsMesh result to be affected by changing setEnabled flag. If you notice this is what is happening now: 1) I have two meshes enabled. No overlapping. intersectsMesh gives false. 2) I disable one of them. Nothing else is different. Position etc are same. 3) intersectsMesh suddenly gives true. I can do checking on my end to avoid this undesired behaviour of course, but I prefer to bring it up if it is really a bug as I thought. It is surely strange to me. Following what you said, one would not expect its output to change at least in this scenario. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 13, 2017 Share Posted January 13, 2017 Hello, this is because the sphere is disabled before being rendered so its world matrix is not updated. Here is a fix: http://www.babylonjs-playground.com/#PD7PP#2 digitspro 1 Quote Link to comment Share on other sites More sharing options...
digitspro Posted January 14, 2017 Author Share Posted January 14, 2017 Got it. That makes sense, so you do not compute its world matrix for efficiency when it is disabled. Thanks! GameMonetize 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.