styxxx Posted November 20, 2015 Share Posted November 20, 2015 When setting (0,0,0) as initial vector all other normal and binormal vectors of points in the path will be (0,0,0) too (not just the first). I don't know if this is a bug or a feature since the initial vector probably isn't supposed to be (0,0,0). Maybe this should trigger a warning? I almos went crazy since I didn't find the error. :/ Example:http://www.babylonjs-playground.com/#7SQDY Quote Link to comment Share on other sites More sharing options...
jerome Posted November 21, 2015 Share Posted November 21, 2015 http://doc.babylonjs.com/classes/2.2/Path3D The second parameter, if you really need it, is not the initial point of the path3D, but the initial normal direction. It allows to set a wanted normal direction (example : colinear to Y World axis), so it can't be (0, 0, 0) obviously. This should be better documented actually.I'll do it.If you don't set the initial normal, Path3D will compute one for you. example with the first normal direction equals to Y : http://www.babylonjs-playground.com/#7SQDY#1 adam 1 Quote Link to comment Share on other sites More sharing options...
adam Posted November 21, 2015 Share Posted November 21, 2015 Is there currently a way to pass the initial normal direction to CreateTube? Quote Link to comment Share on other sites More sharing options...
jerome Posted November 21, 2015 Share Posted November 21, 2015 The initial normal direction is useful if you want that your Path3D has its first normal, say, orientated "up"This doesn't mean necesseraly colinear to Y because your path may not allow this.Actually, it will compute the projection of this first normal on the plane orthogonal to the first path tangent on the first path point (I know, maths are boring ) In the case of a tube, the underlying Path3D object is computed to make the tube twist smoothly around a curved path. The tube is built with many planar circles, each orthogonal to the tangent of the curve on each path point.So the normal of the Path3D on each point is just one of the many circle radius (point).What I mean is that, while a circle is symetric on every direction around its center, the first normal has no real importance for a tube.So, to answer your question : you can't set the first normal direction for a tube. However, it could have an effect for another Path3D mesh that may not be symetric : Extrusion.That's why, the first normal of Extrusion is explicitly computed to fit the Y axis of the shape model to be extruded. Quote Link to comment Share on other sites More sharing options...
adam Posted November 21, 2015 Share Posted November 21, 2015 What would be the best way to create a basic pipe like this with CreateTube?http://www.amazon.co.uk/White-PVC-U-Water-Connector-Adapter/dp/B00BG8XPI4#I was able to do it by doubling up on the first path vector, but that seems hacky to me. Quote Link to comment Share on other sites More sharing options...
jerome Posted November 21, 2015 Share Posted November 21, 2015 I think the best would be to define a path with a Bezier curve making a nice roundness Quote Link to comment Share on other sites More sharing options...
adam Posted November 21, 2015 Share Posted November 21, 2015 I'm planning on fitting the pipes together, so one end normal should be at (-1, 0, 0) and the other end normal should be at (0, -1, 0). If I just pass it a quarter circle path, I end up with this: http://www.babylonjs-playground.com/#19HCIZ I probably can play with the curve to get something close to the end normals I need, but I don't think the tubes will end up fitting as nicely as I'd like on the map. I'm thinking I'm going to have to use CSG with a simple Torus or model it in Blender. It's too bad because I really like how you can pass a scale function to CreateTube. Quote Link to comment Share on other sites More sharing options...
jerome Posted November 22, 2015 Share Posted November 22, 2015 Well, pipes are really specific kind of tubes, because they don't twist and can't follow any type of path.I guess it's quite difficult to do a pipe from a BJS tube as it is actually. The best way for this specific would, imho, to build a dedicated geometry (many circles orthogonal to the path, but without twist) and then to ribbonize it. I'll check soon if the current CreateTube alog could get this behavior easily with a parameter ("dontTwist" ?). Not that obvious as the current tube is built in purpose ontop the Path3D which solves the bad twistting default behavior. adam 1 Quote Link to comment Share on other sites More sharing options...
adam Posted November 22, 2015 Share Posted November 22, 2015 Thanks Jerome. I thought I was able to overcome this problem in the past by doubling up on the first and last vectors to force the normal I want onto the path. It doesn't seem to work now. http://www.babylonjs-playground.com/#19HCIZ#3 I wish I could find the old PG where I thought I got that to work. 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.