Shakes Posted January 3, 2017 Share Posted January 3, 2017 Hey guys, I am currently working on a litte project but I need to have a way to check if between two different Meshes theres another one. The current Situation is, that the Ray ignores Walls and just goes through them and so I get meshes which are behind obstacles. For an example: I want to make some kind of this: http://babylonjs-playground.com/#1QF77H#2 --- Important here is, that the waypoints in my Code are imported by Blender and are saved in an Array (TP), if this maks any difference... The problem is, I cannot transfer this into my code, and I since now I invested about 2 hours of testing an rewriting things but I always get far too many points.Maybe the problem is the if-statement in line 12 (screen). I really hope you guys can help me Shakes EDIT: Sorry for all grammar and/or other mistakes :/ Quote Link to comment Share on other sites More sharing options...
Shakes Posted January 4, 2017 Author Share Posted January 4, 2017 I still can't find my mistake... is there nobody who knows about BABYLON.Ray ? In die Demo (Link above) it works perfect Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 4, 2017 Share Posted January 4, 2017 Hello can you please create a repro on the Playground? It is tough to help you just with a screen capture However some things are suspicious: - intersectsBox requires a bounding box (http://doc.babylonjs.com/classes/2.5/Ray#intersectsbox-box-rarr-boolean) and not a bounding info so it should be ray.intersectsBox(otherMesh.getBoundingInfo().boundingBox - intersectsBox works in mesh world so I suggest using a simpler version with: ray = BABYLON.Ray.Transform(ray, BABYLON.Matrix.Invert(mesh.getWorldMatrix()) if (mesh.intersects(ray)) { ... } Quote Link to comment Share on other sites More sharing options...
Shakes Posted January 5, 2017 Author Share Posted January 5, 2017 Hey, @Deltakosh I tried your ways but it also didn't work, after testing a little bit I moved the box around and you can see here (http://babylonjs-playground.com/#CJXIU#1) the scenario I want to have. But if you remove the // in line 19 you move the wall away and now it has to draw a line between every single Waypoint. But it doesn't, the position is not updated even if the boundingbox is at the "right" coordinates. Another thing is this playground here: http://www.babylonjs-playground.com/#1NE4XO#18 Theres the same problem. If you move the normal box (where you want to check the ray with) away (Line 18) it writes in the console "hit" if the ray hits the position of the box when you don't move it. How I can update the position so that these mistakes will not appear ? Quote Link to comment Share on other sites More sharing options...
adam Posted January 5, 2017 Share Posted January 5, 2017 This example might help: http://www.babylonjs-playground.com/#ZHDBJ#19 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.