dbs2000 Posted July 31, 2015 Share Posted July 31, 2015 I am facing a strange problem. I am trying to draw tubes between points. The points are determined based on some mathematical logic. Strange thing is that for some combination of coordinated the tubes don't show up. Below is an example. var path = [];path.push(new BABYLON.Vector3(22, -3.1945000000000014, 0)) //point 1A//path.push(new BABYLON.Vector3(22, -3.1944000000000017, 0)) //point 1Bpath.push(new BABYLON.Vector3(22, 24.25, 0)) //point 2var tube = BABYLON.Mesh.CreateTube("tube", path, .15, 16, null, 0, scene, false, BABYLON.Mesh.FRONTSIDE) If I run the above code the tube will NOT show. But if i comment "point 1A" and uncomment "point 1B" then the line will show up. If you notice the difference between "point 1A" & "point 1B" is in value of "y". Its a very small difference. For some combination of points the tube totally disappears. For slightly higher or lower values of "y" it again shows up. Another thing is the sequence.. If I add the "point 2" before "point 1B" then also the tube does not show. Quote Link to comment Share on other sites More sharing options...
jerome Posted August 1, 2015 Share Posted August 1, 2015 a PG maybe ? Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 1, 2015 Share Posted August 1, 2015 http://www.babylonjs-playground.com/#1EVT9Z#2 Rem line 25, activate 26, tube appears. *scratch scratch* Quote Link to comment Share on other sites More sharing options...
jerome Posted August 1, 2015 Share Posted August 1, 2015 http://www.babylonjs-playground.com/#1EVT9Z#3 Ok, it seems the problem is not related to the number of points in the tube path, but more to the way the underlying path3D is computed (probably the way the first normal and tangent are computed)If you set y value other than -3.194 to the fist path point, it seems to work in your case. I did a change in the path3D algorythm a month ago in order to simplify the code, but it seems to have imply this bug.I need to check it when I will be back at work at the end of august. Sorry for the delay Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 1, 2015 Share Posted August 1, 2015 You don't get to code-play at home, Jeromino? What's the story there? (like it's any of MY beeswax) Need a home puter? I got a used VIC-20 here that I'm sure would run Knoppix. Want me to mail it to you? If it's your girl... demanding quality time... well... you're pretty much screwed, there. I can't help with that. I traded all my girlfriends... for 6 Western Digital 4tb external hard drives. What a great deal! heh Quote Link to comment Share on other sites More sharing options...
jerome Posted August 2, 2015 Share Posted August 2, 2015 Quote Link to comment Share on other sites More sharing options...
dbs2000 Posted August 3, 2015 Author Share Posted August 3, 2015 The problem is that these positions are calculated dynamically. I am trying to build a 3 dimensional topology structure made of objects that are connected with tubes. This structure would be driven by a data file & hence it would be dynamic & can have different number & combination of objects with connections depending on what is there in the data file. So as you can understand the positions of the tubes (rather the position of the "to" & "from" points of the tube ) is not hard coded & is calculated at runtime. So hard coding is not a option. So what you guys suggest me here? Is there some logic that I can use to avoid some specific "points" to create the "path" tube. Some logic that I would apply on the calculated values. If it does not pass then I use the nearest value & so on & so forth. Basically some logic to bypass this bug that is there. Otherwise, I am, kind of hitting a wall here. Quote Link to comment Share on other sites More sharing options...
jerome Posted August 3, 2015 Share Posted August 3, 2015 No, no, don't change anything pleaseThe tube should work with any path. Actually there might be a problem in the path3D computation : a path3D object is created on the tube path parameter.It used to work pretty well with the original implementation that I stressed heavily to test it. I guess the modification done recently in the path3D code brought this erratic behavior on limit cases : the tube path maybe collinear with one of the world axis, I don't really know. I will investigate as soon as I will get back to work... the only place where I dig in BJS Quote Link to comment Share on other sites More sharing options...
adam Posted August 3, 2015 Share Posted August 3, 2015 The problem is that these positions are calculated dynamically. I am trying to build a 3 dimensional topology structure made of objects that are connected with tubes. This structure would be driven by a data file & hence it would be dynamic & can have different number & combination of objects with connections depending on what is there in the data file. So as you can understand the positions of the tubes (rather the position of the "to" & "from" points of the tube ) is not hard coded & is calculated at runtime. So hard coding is not a option. So what you guys suggest me here? Is there some logic that I can use to avoid some specific "points" to create the "path" tube. Some logic that I would apply on the calculated values. If it does not pass then I use the nearest value & so on & so forth. Basically some logic to bypass this bug that is there. Otherwise, I am, kind of hitting a wall here. Simply use an older version of BJS while you are waiting for the fix. See if this one works:https://github.com/BabylonJS/Babylon.js/tree/c8400bee9880c4dc44a668c554e5dfeabd48c539/dist/preview%20release%20-%20alpha Quote Link to comment Share on other sites More sharing options...
dbs2000 Posted August 3, 2015 Author Share Posted August 3, 2015 Ok.. Thanks for the replies... I will wait for the fix & in the meantime will check with an older version... If you can kindly post a reply on this post once fixed that will be great!... thanks... Quote Link to comment Share on other sites More sharing options...
jerome Posted August 3, 2015 Share Posted August 3, 2015 if your path has only two points, maybe could you use a Cylinder instead of a tube meantime ? here are the last path3D commits :https://github.com/BabylonJS/Babylon.js/commit/9b91bee3d693d692ebdcc9da83c898f1f52455d2https://github.com/BabylonJS/Babylon.js/commit/c68262975a13ccce604a395ca653ebdf2ce7898b I'll check at the end of august Quote Link to comment Share on other sites More sharing options...
dbs2000 Posted August 10, 2015 Author Share Posted August 10, 2015 Thanks Jerome... Yes, I have tried with cylinder using this link (code from deltakosh)..http://www.html5gamedevs.com/topic/9015-cylinder-between-two-points/ But it seems there is a problem with this code.If I change the positions of the spheres then the cylinder would no longer connect Like if i change thiswhiteSphere.position = new BABYLON.Vector3(-20,0,0);towhiteSphere.position = new BABYLON.Vector3(-20,-20,0); then then it will not work Quote Link to comment Share on other sites More sharing options...
jerome Posted August 10, 2015 Share Posted August 10, 2015 Please take a look at this : http://doc.babylonjs.com/overviews/How_Rotations_and_Translations_Work "Generating a rotation from a target system" section with this PG example : http://www.babylonjs-playground.com/#VYM1E#5 Quote Link to comment Share on other sites More sharing options...
jerome Posted September 1, 2015 Share Posted September 1, 2015 OkThis should be fixed now. The problem was this one :The Path3D normals and binormals are computed in a point of the curve path from the tangent in this point and from an arbitrary vector chosen as non-collinear to this tangent.If the tangent normalization is approximated, the choice of the arbitrary vector gave in in some limit cases something collinear with the tangent. Quote Link to comment Share on other sites More sharing options...
RaananW Posted September 1, 2015 Share Posted September 1, 2015 merged. Thanks Jerome! Quote Link to comment Share on other sites More sharing options...
jerome Posted September 1, 2015 Share Posted September 1, 2015 de nada 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.