Announcement

Collapse
No announcement yet.

[ASSETS] [OPEN SOURCE] Tanks, tracks and N-wheeled vehicles

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

    [ASSETS] [OPEN SOURCE] Tanks, tracks and N-wheeled vehicles

    Hi guys,

    I was working on a prototype of off-road tracked vehicle similar to this amphibious beast of engineering:

    It was obvious that I should look into PhysX's tank implementation but I've decided that first I want to get my own implementation in blueprints, to better understand what kind of forces are involved in simulation and how far you have to go in respect to reference materials.
    Prototype started with a huge vehicle, supported by 10 wheels of 2 meter diameter (you can see it in demo). Later, to verify validity of the system, I've switched to M113 APC, as reference materials were somewhat easier to find:
    Click image for larger version

Name:	LandShips_M113.JPG
Views:	1
Size:	68.1 KB
ID:	1160932
    Click image for larger version

Name:	LandShips_M113_2.JPG
Views:	1
Size:	141.2 KB
ID:	1161404

    What is implemented so far:
    • Simple drive-train with engine torque/rpm curve of Detroit Diesel 6V53T engine that was installed on M113A1
    • Semi-automatic gear box with automatic up-shift/down-shift (should be fully automatic) with proper gear ratios of Allison X200-4B, 3-forward and 1-reverse
    • Simple spring and damper to imitate torsion bar suspension
    • Traction of the vehicle is based on friction and torque translated from engine, with a set of separate longtitude-latittude friction coefficients
    • Two set's of rolling friction, "constant" which represents loss of energy due interaction of mechanical parts and "dynamic" which linearly depends on speed and very specific to tracked vehicles
    • Simple friction based brakes
    • Steering of the vehicle is done with differential, which transfers torque between tracks. This allows to do neutral turn - turning at sport by spinning treads in opposite directions. In case of M113 I need to change this logic as they are turning by braking one of the tracks.
    • Two implementations for track animations. First one uses simple skinned mesh with animated texture. Second one uses instanced static mesh to render individual links.
    • Dust particles are spawned depending on the landscape material
    • Crude two way interaction of suspension with other objects. You can land on a back of the carriage and see that it effects it's suspension. Driving over physics rocks is still a bit wonky but it's not a static experience as it was before.
    • Prototype of Aerosled GAZ-98 (RF-8) which is an early proof of concept for component based architecture of the vehicle


    I'm sharing full source of this project on GitHub.
    https://github.com/BoredEngineer/UE4_Tracked_Vehicles
    Code is not too well documented, this is something I need to work on.

    Compiled demo M113, Ripsaw, Aerosled and Mark-I prototype:
    https://www.dropbox.com/s/1rtmxzaib3...icles.zip?dl=0
    [21-th of January 2016]https://www.dropbox.com/s/1rtmxzaib33zz7e/TrackedVehicles.zip?dl=0

    Trello board to track features and notes:
    https://trello.com/b/nb0s5n5N/ue4-ta...eeled-vehicles

    Enjoy!

    Controls:
    Press 1 to posses M113 -> Press E to shift into 1-st gear -> press W to push gas pedal.
    Q/E to downshift-upshift gear. To go backward you need to switch to reverse gear and push gas pedal.
    W to press gas pedal.
    A/D to turn left or right. There is a different logic in place if you press them together with gas pedal (W). When pressed together with gas pedal one tread will start rotating faster in expense of other rotating slower. Without pressing gas, treads will try to spin in opposite directions.
    S to brake on both treads.
    Pay attention to engine RPM. Optimum RPM for this specific engine is around 1800 (green) the red-line starts around 2800, over that torque drops to 0.
    Sometimes you will lose control of the vehicle - it won't be able to turn, this is because the engine is in the red zone and there is no torque provided to tracks, either shift gear up or press on breaks.

    Video Tutorial - How to get your own vehicle plugged into the system
    OldRaven made this great video tutorial on how to setup your own tank using these blueprints. Thank you, OldRaven!

    First part - how to change visual model:


    Second part - wiring of wheels and suspension:


    Third Part - setting up the splines for track animation
    Last edited by BoredEngineer; 01-21-2016, 05:26 PM. Reason: Updates
    Youtube Channel

    #2
    just tried it, looks like you have a decent start, keep up the good work, I want to see how far you get with it because I have challenger tank model just waiting to be implemented

    ps. it looks weird seeing the collision and stuff while driving

    Comment


      #3
      Originally posted by smokey13 View Post
      just tried it, looks like you have a decent start, keep up the good work, I want to see how far you get with it because I have challenger tank model just waiting to be implemented
      I had a base of M1A1 at some point, unfortunately I wasn't able to find all necessary references for it, such as gear box, converter, differential ratios. I do have it's power turbine. It's possible to build something that drives nicely without them but there are enough places where variable have to be guesstimated already
      Challenger have a nice symmetrical wheel base with really cool hydro-pneumatic suspension, in principal it should drive like a cruise boat over the landscape. Do you have some reference materials for it? I wasn't too keen to buy a 300$ book about tanks just to get gear box ratios for T-34.

      Originally posted by smokey13 View Post
      ps. it looks weird seeing the collision and stuff while driving
      Agree, I'm so used to it that I don't notice it anymore. I'll add some button to switch it on/off.
      Youtube Channel

      Comment


        #4
        nice to see someone having a go at this, in my old life i used to fix things like that (Brittish) CVRT, FV430, though never did the chieften tank, i know the Challanger has a rollsroyce CV12 (v12) diesel but don't know the specs for the drive train
        that said the FV430 series has recently been upgraded with a new engine+drivetrain also the cvrt had a makeover but afaik was just an engine swap

        but its nice to see someone who knows the difference between a normal turn and a neutral turn
        UT40K:The Chosen - Warhammer 40,000 for UE4
        ut40kgeodav - UE4 Tutorials

        Comment


          #5
          Originally posted by Geodav View Post
          nice to see someone having a go at this, in my old life i used to fix things like that (Brittish) CVRT, FV430, though never did the chieften tank, i know the Challanger has a rollsroyce CV12 (v12) diesel but don't know the specs for the drive train
          that said the FV430 series has recently been upgraded with a new engine+drivetrain also the cvrt had a makeover but afaik was just an engine swap

          but its nice to see someone who knows the difference between a normal turn and a neutral turn
          Thank you I was thinking about which next vehicle to add, it was suppose to be Ripsaw, but I'll look tomorrow if Ripsaw or Challenger have easily obtainable reference materials.
          I want to look into M3 or M5 half-tracks as well, it will be a good exercise to decompose main blueprint into such pieces that treads and wheels could be used at the same time.
          __________________________________________________________
          Updated link to a new version. Debug mode is switched off by default. Tweaked engine and friction parameters, overall should look cleaner.
          The "proving grounds" on the map are actually build to test specifically M113 - 60% maximum slope, 1.7 meter wide trenches and some rocks to test 41 cm clearance.
          Youtube Channel

          Comment


            #6
            Weren't too happy about animating tracks with just a texture.
            So far I found about 5 different types of tracks that can be installed on M113, I'm going to imitate specifically this one:
            Click image for larger version

Name:	M113-tracks-closeup-3.jpg
Views:	1
Size:	173.2 KB
ID:	1087332

            I want a higher level of detail for my project, so each tread have to be rendered as mesh:
            Click image for larger version

Name:	M113_Tracks.jpg
Views:	1
Size:	119.5 KB
ID:	1087331
            What you see is only the central part of the tread, without rubber pad and pins which connect them to each other. Pins need to be done as a separate mesh as they have a different pivot and placed between tread pads.
            The way it's done right now is rather simple. I have a spline component which sets the path of the track in normal state, aka when tank is just resting on a flat terrain. As suspension starts to engage uneven surfaces I move points of the spline to follow wheels, automatically calculated tangents bend nicely bend spline.
            The problem with this approach so far is that when spline points move, length of the spline starts to change which leads to shifting position of the tread meshes. So I need to somehow keep length of the spline around some predefined value.
            One of the solutions to this is to place a spring on the idler (top wheel at the back) and compress it in proportion to (target spline length - current spline length). This means that if I link one of the spline points to idler, track should follow it and compress/decompress to keep it's target length. Unfortunately, M113 doesn't have a spring on the idler in real life There are some tanks that could use that, but there are plenty which don't rely on such setup. So I need some other solution. The only workaround I can think so far is to selectively scale tangents on spline points to make track path less curvy, but I don't think it would be enough to compensate all the stretching that track gets even from a single wheel:
            Click image for larger version

Name:	M113_Curvy_Track.jpg
Views:	1
Size:	76.1 KB
ID:	1087333
            Youtube Channel

            Comment


              #7
              amazing what your doing here, but isn't it a little to much for game content, i can understand it if your trying for a full tank sim but not sure if the computers/engine could handel all the info/anim date that is required if you have multiple tanks driving together.
              just a little something to keep in mind.

              btw the rear idler wheel is used to tention the track but rarely dynamicly , also not sure if that type of 'tank' has top rollers for the tread, i think the russian tanks have what you show but not sure
              UT40K:The Chosen - Warhammer 40,000 for UE4
              ut40kgeodav - UE4 Tutorials

              Comment


                #8
                Thank you! It might be a bit too much. The vehicle that I want to build would be an up-scaled version of Vityaz DT-30 (youtube video in first post), with drive wheels of about 1 meter in diameter or bigger. So when you stand next to it in first person, details of the tracks would be quite visible. For the LODs it should be easy to fall back to animated texture on skinned mesh and I can do it even for "hero" tank when speed of the track is just too large to distinguish separate links.

                Ohh, now I see that I've missed one detail - track elements are Instanced Static Meshes, they should render rather fast and performance hit comes from updating instances with new transform each frame. Which again can be done less frequent with the distance.

                I've seen one drawing of M133 with top rollers but not a single photo with such setup, most likely it was just a mistake. Tanks with Christie suspension, like T-34 didn't had rollers, most likely because amplitude of how far up/down wheel could move was so large that wheel could hit top roller.
                You are right, it shouldn't be dynamic on M113, I could make a dynamic idler for something like Ripsaw spring loaded wheel. But M113 and plenty of other tanks need different solution.

                P.S. Battlefield 4 got away with so many simplifications, like here wheels are not even connected to axle of torsion bar
                https://img.4plebs.org/boards/pol/im...6848690805.png
                But I'm just being picky, didn't noticed this before at all.
                Last edited by BoredEngineer; 09-10-2015, 07:35 AM.
                Youtube Channel

                Comment


                  #9
                  yep there's lots more to tracked vehicles than most people realise, but it does sound like you know what your doing so go for it , i admit it can be hard to find details on these vehicles as a lot of even older ones are still in service around the world
                  UT40K:The Chosen - Warhammer 40,000 for UE4
                  ut40kgeodav - UE4 Tutorials

                  Comment


                    #10
                    It took about dozens of links to find a data on diameter of sprocket for metal tracks on M113. Fortunately I found a post on scale models forum, where guy just went to garage and measured it on real machine

                    Another issue I have is really weird one, somehow I can't match speed of tread to speed of sprocket. This is like a basic physics.
                    1) Calculate angular velocity of sprocket in radians, this comes from engine and other factors which influence tracks
                    2) Turn it into degrees, multiply by DeltaT and call Add Local Rotation on sprocket mesh
                    3) Then "sprocket angular velocity * sprocket radius" should be the linear velocity of the track. Radius can be scaled by few centimeters as tread is not placed on edge of sprocket. But anyway the result is not even close to what is expected. I was able to somewhat match the speed only when I assume that sprocket radius is about twice as small.

                    "W" is axle angular velocity
                    "AddLocalRotation( RadiansToDegree(W) )" is animation of sprocket
                    "W * SprocketRadius" is linear velocity of track.
                    But this doesn't match visually,
                    " W * SprocketRadius * 1/2" somewhat matches it but not exactly, which doesn't make sense.
                    Youtube Channel

                    Comment


                      #11
                      not sure where i can help on this but be carefull with the calculations, as my teacher told me many years ago , when vehicle moves at 50km the track on the ground it moves at 0km and the track above the wheel moves at 100km
                      this sounds wierd but is relative to the ground and not to the vectors involved.

                      now we know that the track can't stretch so thats set, using radians makes it even harder which i thought had been removed from ue, tbh my maths isn't that good anymore
                      UT40K:The Chosen - Warhammer 40,000 for UE4
                      ut40kgeodav - UE4 Tutorials

                      Comment


                        #12
                        New version is up. Tracks are now done as an array of instanced static meshes. Spline animation still need some work but I think it's possible to get a decent results with such approach:
                        Click image for larger version

Name:	StaticMesh_Tracks.JPG
Views:	1
Size:	67.1 KB
ID:	1087701

                        - Fixed issue with double speed - function which animate tracks was called twice
                        - Added reaction force from suspension, now it affects other objects in scene. You can use ramp to drop on top of the truck and carriage or a platform, placed over two M113s. Boulders react to suspension too, but it's all very glitch at the moment as suspension reacts instantly.
                        - Track configuration is different from what I wanted to implement, but this one requires twice less track parts to animate.
                        - There is annoying issue with animation. As length of the spline changes tracks are moving to accommodate new length. But I have some ideas on how to fix it.
                        Last edited by BoredEngineer; 09-16-2015, 08:12 AM.
                        Youtube Channel

                        Comment


                          #13
                          thats is looking amazing, i'll be very honest that i wouldn't even think about trying it
                          UT40K:The Chosen - Warhammer 40,000 for UE4
                          ut40kgeodav - UE4 Tutorials

                          Comment


                            #14
                            Thank you!
                            Tracks animation needs an overhaul to support more correct collision. But it would be awkward to do it in blueprints, I'll see how it goes with C++ implementation. One approach is to build a specialized version of rope, with a set of box collisions, seams to be a typical approach in state of the art demos. Another approach is to keep using spline but iteratively conform it to landscape and rollers. Later should have a better performance and LOD scalability.

                            Maybe it's better to move this thread to "Work In Progress" section? I'm not sure if this is a right place for it. Could you please do it for me, Geodav?
                            Youtube Channel

                            Comment


                              #15
                              These guys made an amazing job in how tracks are animated:

                              When used together with deformable landscape, you can see how tread links between wheels are a bit higher as they don't compress soil as much as ones under the roll wheels.
                              Last edited by BoredEngineer; 09-16-2015, 08:11 AM.
                              Youtube Channel

                              Comment

                              Working...
                              X