Search the Community
Showing results for tags 'track'.
-
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
-
I try to build an endless Track for a small Game and currently I stuck on an textureproblem. https://www.babylonjs-playground.com/index.html#9HEBCE#12 I use the CreateRibbon Method to build a lane out of an array. When I have 200 segments I remove the one at the top and move the camera temporary to the first one so currently it just looks like the lane is just waving but in reality the camera is moving (you can see it when you remove the camera position setting at the bottom.) I scale the texture to fit the whole mesh but then it looks like the track is not moving I tryed it it the vOffset but that didnt worket out. What I need is some kind of "material/shader" which projects a texture always in the same way, no mater where the mesh is in the world so it would look like the track moves. Or maybe someone have an another Idea how to achieve this. Thanks
-
Hi, Is it possible to create conveyor belt effect with Arcade physics system? Like this example made with box2d, but on Arcade http://phaser.io/examples/v2/box2d/conveyor-belt#gv Of course, conveyor tracks will have to be horizontal.
-
Hi everyone, I'm developing a simple runner game, and I'm wondering what is the best way to implement endless landscape with curved track in Babylon.js. I've read a lot of articles about this, and figured out which techniques to use, but I still cannot figure out how to bring these things to work together. There are several main problems: 1. Generate the landscape 2. Generate the curved track 3. Hide the next landscape prefab so the player wont be aware of the generation process 4. Connect the generated prefab to the current landscape in way that will give a smooth transition. As I understand the best technique to use for the landscape generation is height map based on Perlin Noise generated texture. The question is how can I generate two ground meshes which can connect smoothly each to other. Is there any way to apply constraints on Perlin Noise algorithm? As for generating the track I thought about extrusion based on Bezier Curve points, but again, how can I generate it on the generated landscape? Finally I came to the conclusion that the best way to hide the generation of the next prefab is the turns along the track. I thought about track with hills next to both edges (in other words, the track should be a kind of canyon), and before the transition to the next prefab there should be a sharp turn which hides the prefab. Although a can think about "how it should be implemented" theoretically, a still cannot figure out how can I bring these things to work together. Any help would be appreciated!
- 4 replies
-
- track
- procedural
-
(and 2 more)
Tagged with: