Announcement

Collapse
No announcement yet.

Train with multiple axles on a spline?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Train with multiple axles on a spline?

    Hi!

    Did anyone ever ask themself how we would get a spline-based train working with blueprints? Most trains have two or three axle per bogey and two bogeys per car. In UE4 I guess it would be best to have one axle powered and the others dragged behind along the spline (otherwise the distance between the components might get changed, I suppose).



    I would love to create some train or rollercoaster games but unless someone has a solution, we need a special component for this.
    Attached Files

    #2
    I haven't tried anything like this before, but here's my suggestion. Can't you literally just make a track like they have in real life, and just make a cart that fits onto the track? Maybe have some wheels on the bottom-inside of the cart that roll it along the track. I am not completely sure how the physics in UE4 work, but this should work just like in real life.
    Marketplace Assets

    Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
    Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
    Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

    Comment


      #3
      I tried that some months ago but the physics weren't good/accurate enough for this to work. Especially not at higher speeds. That's why I'd like to see a spline-based solution.

      Comment


        #4
        Well, not sure what to tell you then
        Marketplace Assets

        Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
        Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
        Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

        Comment


          #5
          Here are some links that might help youThe 3rd one should be the best)

          https://answers.unrealengine.com/que...ml?sort=oldest
          https://answers.unrealengine.com/que...line-path.html

          https://forums.unrealengine.com/show...ium-style-game
          Last edited by Jamendxman3; 04-26-2015, 04:03 PM.
          Marketplace Assets

          Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
          Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
          Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

          Comment


            #6
            If you are going for a spline based solution then you can ignore physics entirely and just animate it along the spline? I agree the physics doesn't work well enough for this type of thing to be done completely realistically. I have been working on creating engines in game that work physically accurately, and while they can function "OK" I wouldn't really use them in a proper game.

            Comment


              #7
              @Jamendxman3: Thanks. I should have mentioned that I know how to make something run along a spline. But your links gave me an idea I have to test when I have enough time.

              @ZoltanJr: Think of a rollercoaster. The front wheels of the car are over the top point of a hill while the rear wheels are not. That's where physics would come in handy. Just something that is locked to the spline and rolls physically correct forwards and backwards and can be dragged by another thing on the spline if connected to it.

              Comment


                #8
                Here is some interesting reading on the subject:

                http://www.learn-cocos2d.com/2012/07...eeform-tracks/
                Linux Support page (Wiki): https://wiki.unrealengine.com/Linux_Support
                Linux Demos page (Wiki): https://wiki.unrealengine.com/Linux_Demos
                My Unreal Engine 4 Linux repo: https://github.com/3dluvr/UnrealEngine/

                Comment


                  #9
                  If you just animate the front 1 along a spline based on the angle of the slope to change speed etc then you should be able to use physics constraints to attach the carriages to it and they will get pulled along. Figuring out the constraint to stop the train bouncing off the tracks would be an interesting 1 though.

                  Comment


                    #10
                    Well, physics are no option at all as you can see:

                    Comment


                      #11
                      I recognize this is a older thread/topic, but I am actually trying to figure out the best way to get a train to function in UE4. Most people have used Splines, but a lot of the time the train looks terrible when following a spline and it looks like it's derailing when it's not.

                      There is however one person I have seen done it with physics (they confirmed this themselves). You can find a video of their work here:



                      If you look in the video comments, someone asked what they are using and the uploader said Physics. How much would the frame rate be hit? It looks like the video uploader didn't have really any frame rate loss. This same person was also able to get the train to smoothly follow a curve (or sort of a curve) in another video of theirs. See here:



                      However they have not stated (yet) if they are using Blueprints or Hard Code. Is there anyone who can shed some light on how this is all done with just physics?

                      Thank you!

                      Comment


                        #12
                        That's impressive. I have no clue how that is possible.

                        Meanwhile I tried to make it look correctly again with splines:

                        However, somehow the simple calculations really slowed it down (as it moves the second bogey multiple times until it's in a range that makes it's position look acceptable) and I doubt it will run well enough with multiple cars, let alone multiple trains.

                        Comment


                          #13
                          Train physics it's possible

                          Hey, I can confirm this and more i asked to him, including I was made ​​a simulation using a blender , because I do not have much knowledge about Unreal yet basically i used motor, hinge constraints how you can see Click image for larger version

Name:	untitled.png
Views:	1
Size:	576.6 KB
ID:	1108331

                          In next image can see the constraints

                          Click image for larger version

Name:	Train.png
Views:	1
Size:	171.0 KB
ID:	1108332


                          This image show the settings of railway

                          Click image for larger version

Name:	Rigidbody.png
Views:	1
Size:	195.2 KB
ID:	1108334

                          and a video



                          As you can see the model has some problems, probably because of parameters, the physical calculation at least on my PC required a lot of processing power which would justify the use of spline in most cases by this angle. But in this simulation I used real physics and if somebody wants the .blend file only need request it.
                          Last edited by Rafael PD; 06-15-2016, 10:57 AM.

                          Comment


                            #14
                            [MENTION=113028]Rafael PD[/MENTION]

                            I think the issue with your simulation is that no real rails ever curve that much in that short of an arc.

                            There are restraints of the track grade and curvature on the railroad to prevent from derailment, sliding backwards on steep grades, among other things.

                            Still, we need to get 401Sly to share with us his method, because his samples looks absolutely great.
                            Linux Support page (Wiki): https://wiki.unrealengine.com/Linux_Support
                            Linux Demos page (Wiki): https://wiki.unrealengine.com/Linux_Demos
                            My Unreal Engine 4 Linux repo: https://github.com/3dluvr/UnrealEngine/

                            Comment


                              #15
                              UE4 The Railway

                              UE4 The Railway

                              I saw some questions over bogie vehicles and tracking around curves there are limitations and am at present gradually refining the method.
                              Here is a short vid of bogie vehicle+train following track using BP physics only.

                              <iframe width="640" height="390" src="https://www.youtube.com/embed/QUa6ZllmQuo" frameborder="0" allowfullscreen></iframe>

                              Regards Sly


                              PS if embed link doesn't work could someone explain the embed process please.

                              Comment

                              Working...
                              X