Announcement

Collapse
No announcement yet.

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

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

    #76
    Ok I began moving lowres versions of my wheels, etc into the blueprint.

    The first sting I did was

    1) Duplicate the M113 blueprint and renamed it CV9035
    2) changed the static wheel mesh to my own wheel mesh

    this is where I noticed something in the current setup.

    The wheels you used are the same front and back.
    My wheels have a different front and back, so in the blueprint I have to rotate the wheels 180 degrees on one side of the vehicle to make them look ok (180 in Z)
    The problem that gives is that the wheels you rotate 180 degrees now rotate backwards when you drive forward. It's cosmetic because it does not affect the driving. I'm sure it's a simple fix. Where can I change the rotation animation of the wheels?

    Comment


      #77
      Originally posted by OldRaven View Post
      Ok I began moving lowres versions of my wheels, etc into the blueprint.

      The first sting I did was

      1) Duplicate the M113 blueprint and renamed it CV9035
      2) changed the static wheel mesh to my own wheel mesh

      this is where I noticed something in the current setup.

      The wheels you used are the same front and back.
      My wheels have a different front and back, so in the blueprint I have to rotate the wheels 180 degrees on one side of the vehicle to make them look ok (180 in Z)
      The problem that gives is that the wheels you rotate 180 degrees now rotate backwards when you drive forward. It's cosmetic because it does not affect the driving. I'm sure it's a simple fix. Where can I change the rotation animation of the wheels?
      Two ways to solve it:
      First is to overload WheelAndSprocketAnimation function of master blueprint in your new blueprint - you could simple copy/paste code from original and add correction for wheel rotation.
      Second is to import left and right side wheels separately as two different static meshes. The assignment of the wheels is done in such a way that all of your wheel can have unique mesh.
      Youtube Channel

      Comment


        #78
        Thanx,

        I think I'm going for a unique mesh for left and right for now.
        A good idea would be to add a checkbox in the Constructor > PositionAndAnimateDriveWheels function that reverses the rotation.
        And same for the Animate Sprocket or Idler function.

        I'll see if I can add that myself.. good exercise , as my blueprint knowledge is limited atm.

        Currently implementing a lowres hull mesh, and adding the extra wheels.

        What is the relation between Suspension and Wheels? Are they somehow connected?
        They are currently in line with the wheel in the Z axis.. which makes sense, but do they have to be inline or does it have no effect if they are offset from each other?

        Comment


          #79


          Ok,

          I have all the wheels, sprockets and idlers in the Blueprint.
          Added suspension handles (M113 has 5 wheels/side, CV90 has 7)

          For now I did not tune the Stiffnessforce and Dampingforce.
          The Hull weight is still at what the M113 is (10 ton)

          The CV90 is around 28 Ton total , and fully armed with extra armour plating even 35 Ton.

          I also have to lookup the Engine specifications and torque curve if I can find it.


          What are the steps I need to do to modify the spine track?
          How do I add point to the spine and hook them up?

          I pretty happy with how it goes.. it pretty straight foreward to setup.

          I'll go through the entire process for the lower part of the CV first before writing it down (or record a short setup video of how I did it)

          Comment


            #80
            So the function which is responsible for animating drive wheels is PositionAndAnimateDriveWheels.
            Click image for larger version

Name:	PositionAndAnimateDriveWheels.JPG
Views:	1
Size:	126.3 KB
ID:	1093793

            I takes position and rotation of the suspension and places wheel at the end of suspension length. Which is kind of a line from suspension root along the Z axis at the distance of current suspension length.

            Now I'm thinking what is the best way to handle this. We should set default rotation of the wheel ether by rotation of the wheel static mesh component or maybe inherit it from suspension.
            Anyway, let me add into the Feature List one thing for sure:
            - ability to flip wheel 180 degrees as boolean parameter to PositionAndAnimateDriveWheels()
            Youtube Channel

            Comment


              #81
              Originally posted by OldRaven View Post


              Ok,

              I have all the wheels, sprockets and idlers in the Blueprint.
              Added suspension handles (M113 has 5 wheels/side, CV90 has 7)

              For now I did not tune the Stiffnessforce and Dampingforce.
              The Hull weight is still at what the M113 is (10 ton)

              The CV90 is around 28 Ton total , and fully armed with extra armour plating even 35 Ton.

              I also have to lookup the Engine specifications and torque curve if I can find it.


              What are the steps I need to do to modify the spine track?
              How do I add point to the spine and hook them up?

              I pretty happy with how it goes.. it pretty straight foreward to setup.

              I'll go through the entire process for the lower part of the CV first before writing it down (or record a short setup video of how I did it)
              This isn't difficult technically but it requires a lot of manual tuning and fiddling with spline coordinates and tangents manually.
              There are three arrays that you need to modify: SplineCoordinatesR, SplineCoordinatesL and SplineTangents. To make things easier for me I usually add a dummy box into blueprint, place it where I think spline point should be and then copy/paste it's coordinates into array. With tangents you just have to manually find some values which work, I haven't found a good way to make it easier.

              Then look at overloaded AnimateTreadsSpline() function. Here you need to add extra nodes (function calls) and change indexes of spline points. There should be one node (function call) per one suspension.
              Youtube Channel

              Comment


                #82
                I don't mind manual tuning and fiddling, I'm really good at that
                I thought you where able to add control point in the editor, but the way you describe it I have to manually add them in the array? Am I correct?

                One thing about handling while driving with the M113 I noticed.. How can you increase the responsiveness when steering.
                When your speed increases it's starting to feel really sluggish , while tracked vehicles are able to do pretty aggressive turns even at higher speeds.

                Comment


                  #83
                  Or a simple Blueprint you can drop in your scene so that you can create the spline visually and then store the coordinates in a variable that you can use to fill the Spline coordinate array

                  something like the content example



                  you can drop a reference model with wheels in the origin of your scene to draw the spline and then store the coordinates.

                  It's a bit weird (and tedious) that you cannot edit a spline in a blueprint in UE4.. or maybe I'm missing something.

                  BTW : I can insert extra spline coordinates manually now, but where can I find the tangent for a coordinate? Or edit the tangent?
                  Last edited by OldRaven; 11-23-2015, 05:39 PM.

                  Comment


                    #84
                    Click image for larger version

Name:	spline_er.jpg
Views:	1
Size:	294.1 KB
ID:	1093833

                    I manually inserted the points and edited their location.
                    Also added and hooked them up in the AnimateThreadSpline function.
                    They move fine, also with the suspension.

                    As you can see.. I just need to edit a couple of tangents.. but I have no clue where to do that.
                    Also need to increase the number of Threads along the spline.. also have no clue where to do that


                    ---------------snip-----------------

                    Wait.. I found the Spline Tangents array
                    Last edited by OldRaven; 11-24-2015, 10:03 AM.

                    Comment


                      #85


                      Here goes.

                      Everything working

                      This time with working tracks!

                      I love how well structured your blueprint is!

                      ----snip----

                      I noticed a small error. wheels 6 and 7 do not make the track respond.. I forgot to hook them up in the splineanimation function.. fixed
                      Last edited by OldRaven; 11-24-2015, 03:38 PM.

                      Comment


                        #86
                        Sorry couldn't reply earlier. I'm glad you found the way how to fix splines! Yes SplineTangents arrays is where it's stored.

                        Regarding controls, one reason for that can be the power output of engine. Turning of the tank is done by reversing torque on one of the tracks. If engine RPM is in a red zone then there is no power and tracks are just rolling, so you can't really turn as you need power for that. In this case you ether upshift or break to loose some speed.
                        If you experience this when engine is not in the red zone than most likely there is simply not enough grip of the track with the ground. Perhaps it should be higher, I didn't really found any reliable friction coefficients for tracks, maybe it's just too low.

                        Looks good! There are few thing which I've noticed. Maybe it makes sense to have a bit thicker treads so they don't clip the landscape so easily. For that you need to tweak two parameters: TreadHalfThickness and CollisionRadius in suspension. CollisionRadius is a radius of the road wheel + thickness on the track element.
                        Another thing is that dust particles should appear only on sand. Did you changed physx materials? Maybe it's a bug with collision query channels.

                        To change amount of the treads look for variable TreadsOnSide. It's the same variable for both sides, in case of M113 it actually should be different
                        Last edited by BoredEngineer; 11-24-2015, 12:54 PM.
                        Youtube Channel

                        Comment


                          #87
                          I saw the threadhalf thickness etc, but did not have time to play with them.

                          I see I made an error, suspension for wheel 6 and 7 is not hooked up to the spline.. that also causes the track not to follow the wheel there, and also go through the floor.
                          Fixed it.

                          I changed the physx material on the floor yes ... that's not a bug.. I like the dust. When I have time I will create a test map.
                          I plan to use Worldbuilder for that.. now is a good time to test that workflow.

                          Next is to replace the thread with my thread.. and I think I will continue detailing the model now.

                          I found torque curves for the engine.
                          CV90 has a Scania DSI 14 or 16 V8.
                          I implemented the 720Hp version and increased the weight of the hull to 24 ton.

                          Btw, the Weight value (for the hull) is that for the complete vehicle? I assume that is only for the lower section (hull, wheels etc) and that the weight of the turret is seperate.

                          The handling is much better with the new Torque curve and weight.

                          Comment


                            #88
                            Originally posted by OldRaven View Post
                            I found torque curves for the engine.
                            CV90 has a Scania DSI 14 or 16 V8.
                            I implemented the 720Hp version and increased the weight of the hull to 24 ton.

                            Btw, the Weight value (for the hull) is that for the complete vehicle? I assume that is only for the lower section (hull, wheels etc) and that the weight of the turret is seperate.

                            The handling is much better with the new Torque curve and weight.
                            If turret will be attached on top, as a physical object that transfers it's weight to the base of the tank then exclude it from chassis weight. Tracks can be included as technically suspension needs to carry at least half of the track weight (the other half is on the ground).

                            Make sure that your engine curve has a "red zone", small range of RPMs at the end of the curve where engine torque is 0. For coloring of the RPM numbers in GUI I use a second curve with a color gradient.

                            The more suspension blocks you have, the less pressure on the ground in contact points (under road wheels) will be, if the supported weight is the same. When you increase weight, you get a better grip of the tracks with the ground.
                            Youtube Channel

                            Comment


                              #89
                              Update:
                              1) Added ability to flip wheel, sprocket and idler animation by 180 degrees.
                              2) Refactored wheel animation function. It makes it little bit faster to customize and avoids annoying bug where functions in child blueprints got corrupted when their definition is changed in parent. This is how it looks in M113 example now:
                              Click image for larger version

Name:	WheelFlipAnimation.JPG
Views:	1
Size:	82.8 KB
ID:	1094442
                              3) Finally added proper friction coefficient calculation. Now MuX and MuY are used as radius for ellipse which defines what specific value of Mu (friction coefficient) should be used depending on the direction of the relative wheel (track under wheel) velocity. Now tank behave correctly and won't spin like crazy if you try to turn it on spot for a while. They are harder too turn now so I've set MuY to 0.6 - half of MuX 1.2, which means it much easier for it to slide sideways then is to slip in place. Ideally Mu should be per-calculated in constructor and stored in an array to later be sampled in real-time.
                              Click image for larger version

Name:	FrictionCircle.JPG
Views:	1
Size:	128.0 KB
ID:	1094445
                              Thank you Olento for this link: www.auto-ware.com/setup/fc1.htm it describes friction circle rather well and from there I got idea to use parametric ellipse equation to find a proper friction coefficient out of two (MuX and MuY) provided by user.

                              Btw, to turn faster you need to let go of gas pedal. The reason for that is when both forward and left/right controls are pressed than half of the torque from one track is directed to another, but when you press only left/right without pressing forward than one of the tracks get a complete torque in negative direction. I'm not sure how it works in real tanks.

                              Next step is to add automatic suspension and make turning easier. Not sure how exactly should be done.
                              Another thing is updating the whole thing to 4.10, do we want that? I don't know if I should make it as a separate branch because most likely all assets will be marked as out of sync for you guys. How should I handle this from source control point of view?
                              Last edited by BoredEngineer; 12-03-2015, 07:14 PM.
                              Youtube Channel

                              Comment


                                #90
                                Regarding friction circle, just in case someone needs it outside of the code. The math is following:
                                if we take a parametric ellipse equation
                                x = a * cos(t)
                                y = b * sin(t)
                                [where t=0..2Pi]
                                then our muX and muY (friction coefficients in X and Y axis of the wheel) can be used as radius of ellipse
                                x = muX * cos(t)
                                y = muY * sin(t)
                                we can find t from a dot product of relative velocity vector of the wheel and forward vector of the wheel
                                t = arccos( dot(V, Fvector))
                                substituting we get
                                x = muX * dot(V, Fvector)
                                y = muY * sqrt(1 - dot(V, Fvector)^2 )
                                then final friction coefficient mu is just length of the vector (x,y), which is a point on the ellipse in the direction of velocity
                                mu = length(x,y)
                                Youtube Channel

                                Comment

                                Working...
                                X