QuintusHegie Posted July 8, 2018 Share Posted July 8, 2018 Hi all, This may be an easy question but I cannot seem to solve it myself after several attempts. For my Model Train Simulator in BabylonJS I'm creating a helix/spiral track, allowing trains on a lower section to quickly gain altitude within a short area (e.g. climbing a mountain). This is often used in 'hidden' sections on model train displays to have a train pass a valley track and next pass a mountain bridge which is position much higher (Y position) in the scene. When I construct the points of a helix/spiral using the formula from the docs https://doc.babylonjs.com/babylon101/parametric_shapes https://www.babylonjs-playground.com/#165IV6#61 And then use Path3D on these points to get the normals see the docs https://doc.babylonjs.com/how_to/how_to_use_path3d https://www.babylonjs-playground.com/#2DLXYB#1 https://www.babylonjs-playground.com/#8ICWNU Then I get an ever increasing cant/superelevation of my track, see the blue arrows in the picture which indicate the 'up' vectors. The result is that the track at the top has a cant. I use the Tangent, Normal and Binormal from the Path3D of the line/points to set the track rail and bed geometry, and position the train always perpendicular to the track (that is: up). But I want to have the Up vector always Vector3.Up(), or at least that there is no cant/superelevation and I can continue placing 'flat' track with it's normal Vector3.Up() on the top. The big blue arrow indicates Vector3.Up(). Current 'vector up' results from Path3D in my game: Blue = up vector (from Path3D). Large blue with _ = helix direction (Y axis) Yellow line through track = Line through the spiral center points (radius * cos t, radius * sin t, ascentfactor * t) Desired 'vector up' on the spiral/helix: (image found at http://www.easyhelix.com) Hope someone knows how to 'alter' the results from Path3D so I get the helix point orientation but without the cant/superelevation. So that I can 'lay the track' properly without trains 'falling off the track' because of cant/superelevation. Bonus questions: - the yellow marked area in the skybox marks another bug that is caused with a reflection texture intersection with the skybox. the default background color comes through on the waves. - the red box marks a mesh (air balloon) with a physics impostor that is already moving, but I want the physics computation to be paused until the user presses some 'start to play'-button, instead of physics computation right from the moment the scene is loading Happy coding, Q Quote Link to comment Share on other sites More sharing options...
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.