binyan Posted May 4, 2015 Share Posted May 4, 2015 Hey guys,I've just noticed that the bounding box of a plane in the debug layer and the bounding box which is taken into account when computing mesh intersection with a point are inconsistent.Here is the playground example (just check the bounding boxes checkbox). So one of them should be fixed... Upd:Another problem is when the plane's bounding box does fit the bounding box of debug layer, there is no intersection at all (that's an obvious problem because of plane thickness I think).Here is the playground sample.Maybe the solution is to give a minimal bounding box thickness of BABYLON.Epsilon. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 5, 2015 Share Posted May 5, 2015 More info here:)http://www.babylonjs-playground.com/?10 Quote Link to comment Share on other sites More sharing options...
binyan Posted May 5, 2015 Author Share Posted May 5, 2015 Well, I'm a new but not that new I've seen this tutorial dozens of times.See, the cases are a bit different. The tutorial covers an intersection of a sphere with a plane (both precise and not) and an intersection of a sphere with a point.In both cases there is no any problem - the bounding box of a sphere is always the same.In my case there is an intersection of a plane with a point. And here is the thing: the intersection of a mesh with a point is always non precise (with a non-scaled bounding box). However in debug layer still appears the precise (scaled) bounding box. Which, in turn, may be very confusing. It took me a couple of hours to understand why do I get an intersection when in the debug layer there is a huge distance between my point and the bounding box of the plane.Also, there is still the second problem I've described in the first post.So, please re-read my first post. I hope now it's clearer Quote Link to comment Share on other sites More sharing options...
RaananW Posted May 5, 2015 Share Posted May 5, 2015 I find both of your examples very interesting :-) The first one - I believe you are right, the debug layer actually shows the precise bounding box but the boundries are different during the intersectsPoint inspection.As the 2nd - I am not sure this is wrong. A plane is just this - very thin, and the y of the point intersected is never 0, due to the cosine calculation. so it never really intersects... Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 5, 2015 Share Posted May 5, 2015 Ok sorry, I misunderstood your ask Actually intersectsPoint use AABB (Axis aligned bounding box) for performance reason and that's why I linked the demo with various version of bounding boxes. Quote Link to comment Share on other sites More sharing options...
binyan Posted May 7, 2015 Author Share Posted May 7, 2015 So maybe it worth to add a precise computation as an option? Just like in the case of the mesh intersection? Also, it maybe useful to let the user define the minimal boundaries (thickness) of the bounding box. I'm not sure this is a problem (maybe it should be this way) but currently there is no way you can get a plane & point intersection. Quote Link to comment Share on other sites More sharing options...
RaananW Posted May 7, 2015 Share Posted May 7, 2015 Well, there is a delta BABYLON.Engine.EpsilonI think that the inspection in the intersectsPoint (in the bounding box inspection) is simply other way around. Have a look here - http://www.babylonjs-playground.com/#1JLKCH#2 , changing the epsilon to negative works. (line 31). @DK, what do you think? var delta in https://github.com/BabylonJS/Babylon.js/blob/master/Babylon/Culling/babylon.BoundingBox.ts#L99 should be -Epsilon ? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 7, 2015 Share Posted May 7, 2015 Right! Quote Link to comment Share on other sites More sharing options...
RaananW Posted May 7, 2015 Share Posted May 7, 2015 fix coming up for 2.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.