Announcement

Collapse
No announcement yet.

[OPEN-SOURCE] Machinery Modelling Toolkit

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

    #61
    Two questions:
    - Are you using Nvidia Physx ? If no, you got plan to support ?
    - This support normal vehicles too of 4 wheels etc ?

    I got the problem with the default Unreal Engine 4 support because I can't change the vehicle engine or wheels parameters in-game, so here I can ?
    Hevedy - Instance Tools: https://hevedy.itch.io/hevedyinstances
    Hevedy - Image Tools: https://hevedy.itch.io/imagetools

    Comment


      #62
      Originally posted by Hevedy View Post
      Two questions:
      - Are you using Nvidia Physx ? If no, you got plan to support ?
      - This support normal vehicles too of 4 wheels etc ?

      I got the problem with the default Unreal Engine 4 support because I can't change the vehicle engine or wheels parameters in-game, so here I can ?
      It's all UE4 build in physics, which means yes - it uses PhysX. I don't have particular components which simulate wheel yet. Anisotropic friction component can be used to create simple wheel, but this might not simulate tire on the level of how PhysX vehicle does it. I'm planning to add similar component in the feature.
      Here you can change as much as you want whenever you want. We can even expose SetMass and SetInertiaTensor to BP using plugin, it's all custom made specifically so one could build anything they want
      Youtube Channel

      Comment


        #63
        BoredEngineer you're awesome! Keep up the goodwork!

        Comment


          #64
          Originally posted by tarr_bot View Post
          BoredEngineer you're awesome! Keep up the goodwork!
          Thank you!

          I've tested manual brake steering, separately for left and right tracks. It's too sensitive to steer this way and by holding brake for more than half a second you can send M113 into a spin, if sensitivity is lowered than it turns sluggishly. Maybe some nonlinear coefficient would help but I don't think it is user friendly to have 4 button combinations just to turn left/right. Unless you are into building a simulator and want that kind of details.
          The solution to easiness of control and no cheating physics is to use a dedicated PID controller which applies more brake power if we turn too slow and less if we turning with just right speed. The aggressiveness of steering is control by P coefficient of PID controller, tweak it to get a behavior that you like.
          Fresh version is uploaded to GitHub and latest executable is as always by this link: https://www.dropbox.com/s/55dazkm8q4...ntent.zip?dl=0
          Youtube Channel

          Comment


            #65
            Originally posted by BoredEngineer View Post
            Thank you!
            It's developed as a plugin, so it can be copy/pasted into any project to provide essential functions for custom physics calculations. C++ code of the plugin is always included, to be able to compile it for different platforms and any version of the engine.

            As a note, there are two parts:
            1) Plugin - contains basic classes and functions which provides means to do your own calculations during physics sub-stepping in blueprints
            2) Content example - provides examples of custom BP components which can be used to model machines

            Regarding integration in general. I'll be upgrading both plugin and content examples when 4.11 is released, 4.10 version will go into a separate branch. Same will happen to 4.11 when 4.12 is released. But nothing prevents you from using plugin and content examples with the latest version of UE4, it's just certain things might not work as expected. If something works differently in latest version it can be always patched up.

            Long term plan is to move the most re-usable components into C++, like PID controller for example. Some components will stay implemented only in BP, so it's easier to make a copy of them and customize for a specific machine. For example, air pressure thruster component is very specific to hovercrafts and hardly can be used on anything else. Something like a propeller engine, can be used on many different machines, so it makes sense to move it to C++ and leave BP code as reference.
            The reason why I'm saying this ^ is because I'm not sure how someone can integrate with BP project. With plugin it's easy, you just copy/paste a fresh version into your project and its done. In some cases you might need to re-compile BPs.
            With BP projects you need to migrate assets and while engine will pickup all dependencies himself, I'm not sure how something like hovercraft can be used as a basis. For example with Tracked Vehicles, there is a base BP class A_TrackedVehicles, which contains minimal amount of visual elements but contains almost all code. One can create a child of it and provide it with their own models and settings of variables. Later when you want to update to latest version of A_TrackedVehicles, you simply migrate it into your project and re-compile child blueprint. With hovercraft this is not the case - making a child of it will inherit all visual and logical components which can't be removed, only their settings can be altered. Most of the logic is inside of the components and those can be updated by migrating fresh version. The "glue" code is in the pawn itself, could be migrated if you don't change it in your custom machine, otherwise can be copy/pasted if you know what exactly was changed. Tool for comparing BPs can help here but all this sounds like a lot of work to stay up-to-date.

            Ideally, we would have components such as engine, wheels, gear-box and etc. You add them to the pawn or actor and other components would automatically find them and work with them using interface calls. Practically speaking, I think this can be achieved only partially. To have a better control over what is going on you need to write glue code. For example to make sure that component's physics update is done in desired order or to track if some components like a wheel where blown off by explosion/collision. For this glue code to be easily portable, machines have to be build in a more abstract way and it makes sense to do it only if you are planning to have multiple designs of the same type of vehicles in your game.

            Maybe someone can have a better idea how this can be approached. Approach of building everything in C++ and be able to change only data portion in BP, like its done in VehicleComponent, doesn't sound too appealing. But building everything out of "smart" components might tax performance more than necessary. Some hybrid approach is needed.
            I only just got this notification so I wanted to thank you for taking the time to respond!

            Your answers are clear and make sense, I agree it gets really tricky when functionality spreads its dependency across c++ and BP - I really with BPs were just visual code in the sense that migration is easier as per c++.

            Comment


              #66
              Update

              Aerosled RF-8 is back!



              compiled version:
              [MMT Content Compiled]

              Ski friction is simulated using special new component. Later I'll build ski component in more generic way, right now it uses 3 equally spaced points on the mesh to simulate friction. Aerosled has angled suspension (springs are pushing on ski and chassis diagonally, not purely vertically) and at low velocities this creates a bit of a side movement, which friction tries to fight, which pushes sled sideways, which engages suspension, which creates side movement... so we get a viscous cycle and wobbling machine when it is suppose to be standing stationary. This is "fixed" by enabling custom friction only if velocity is high enough (arbitrary value like 20 cm/s) and relying on PhysX friction to handle everything at low velocity. To my surprise, this works really well. The only downside is that you have to match your friction coefficients in physics material and custom friction component. Still, this is much better solution than previous one which used no-friction physics material for ski and relied completely on custom friction.
              This machine is peculiar in a way of how important is airdrag for this machine to work properly. Most of the time, the role of airdrag is more of a force limiting your top speed or adding nice curve to a ballistic trajectory. In case of this machine, airdrag on radiator grid of the engine, works as a lever which stabilizes machine and removes part of the load from front ski at high velocity, this makes steering at high speed less sensitive.

              I'm planning to add some generic component which can be used to flip machines on the wheels/ski/tracks if they landed upside-down. Something akin to how it is done in GTA5, where car will try to flip over automatically if it stay on the roof for more than few seconds.
              Last edited by BoredEngineer; 03-17-2016, 08:47 AM.
              Youtube Channel

              Comment


                #67
                Awesome, each day is looking better and better.

                Can you add an example of a 4 wheels vehicle (car), and 2 wheels one (motorbike) ? To get a clear idea ?
                And if is possible in each vehicle 2 profiles (to simulate for example the customization in realtime in game) as friction changes etc ?
                Hevedy - Instance Tools: https://hevedy.itch.io/hevedyinstances
                Hevedy - Image Tools: https://hevedy.itch.io/imagetools

                Comment


                  #68
                  Originally posted by Hevedy View Post
                  Awesome, each day is looking better and better.

                  Can you add an example of a 4 wheels vehicle (car), and 2 wheels one (motorbike) ? To get a clear idea ?
                  And if is possible in each vehicle 2 profiles (to simulate for example the customization in realtime in game) as friction changes etc ?
                  Well, the funny thing is most likely I'll add airplane parts before I get to the car wheels
                  I need to find some good and simple way for you guys to be able to tweak parameters of tires without looking for reference on 20+ tire parameters that racing sims use. I've talked with 0lento about this recently and we got some good ideas how it could be implemented. So car wheels will be added. Bike wheels is a bit of a different beast. Proper, bike wheel can be steered by tilting it, it should be possible to simulate such behavior but I don't know if we have enough precision for this. Worst case scenario, such behavior could be modeled on the level of the bike itself.
                  A simple example of changing parameters on fly is braking mechanics on Aerosled. In real vehicle, back ski have metal pins which are pushed into the ground when driver presses on brakes. Here, I simulate such braking by changing friction coefficients of back ski when brakes are pressed. Btw, this reminds me that only central point should change coefficients, not all three contact points.

                  I understand that cars is perhaps the most popular subject in vehicles simulation. Unfortunately they are the hardest machines to simulate in real-time. I don't want to build a sub-par solution for them, at the same time I'm not sure if I have enough time and experience to figure out all important aspects of their simulation. Step by step, bit by bit, we will get there. Tire and wheel simulation first, then steering links, anti-roll bars and etc.
                  Youtube Channel

                  Comment


                    #69
                    Love the plane example on your youtube channel!

                    Comment


                      #70
                      Originally posted by OldRaven View Post
                      Love the plane example on your youtube channel!
                      Thank you! Recording came out really bad for some reason. I want to polish it a bit in regards to controls and upload fresh version to repo.
                      Youtube Channel

                      Comment


                        #71
                        Update

                        For this updated I've added a very simple simulation of airfoil. Most of the code was written back in 2014 and now it's moved into component. Airfoils can be used for simulation of spoilers on cars or rudder on hovercraft. They can be used for rudimentary wings too. The model itself is a bit too simple to be used in flight sim, but it can provide some sort of semi-realistic behavior of flight.
                        A bit of a silly example is Aerosled which can fly:
                        Click image for larger version

Name:	Flying_Aerosled.JPG
Views:	1
Size:	133.9 KB
ID:	1102694

                        It's not a good airplane in terms of flight characteristic, but still took about 3 hours in total to tweak size and location for wings and control surfaces.
                        Here are videos from different iterations of trying to get it into air.
                        First successful take-off:


                        This version is a next iteration which can be steered (my apologies for video quality):


                        I don't have a video of latest version but it has a smoother controls, variable engine throttle and more informative GUI. Steering of the aircraft is done by actual rotation of the control surfaces, there no hacks like adding torque to the chassis to pitch airplane. Behavior is driven by lift and drag force generated by airfoil components facing incoming airflow.

                        Uploaded fresh version of the source to repo. Fresh executable is, as always, here: https://www.dropbox.com/s/55dazkm8q4...ntent.zip?dl=0
                        Last edited by BoredEngineer; 03-21-2016, 12:21 PM.
                        Youtube Channel

                        Comment


                          #72
                          Update

                          Fokker Dr.I joins the rank of the MMT machines:
                          Click image for larger version

Name:	Fokker_DrI.JPG
Views:	1
Size:	74.5 KB
ID:	1103203

                          3D model and texture is made by my friend. This is the same aircraft that Manfred von Richthofen "Red Baron" was flying back in WW1. It's an early WIP and many things have to be fixed and cleaned. It flies much better than Aerosled but a bit harder to get off the ground and land as it tends to roll over the wheels. These are my attempts in flying it and landing:


                          Compiled executable as always here:
                          https://www.dropbox.com/s/55dazkm8q4...ntent.zip?dl=0

                          I'll upload code to repo after it's cleaned up.
                          Youtube Channel

                          Comment


                            #73
                            Nice!

                            Somehow I never expected to see an aeroplane in the MMT.. I have no idea why.. but it makes absolute sense..

                            Comment


                              #74
                              Originally posted by OldRaven View Post
                              Nice!

                              Somehow I never expected to see an aeroplane in the MMT.. I have no idea why.. but it makes absolute sense..
                              Thank you!
                              The original name that I liked more was Vehicle Modelling Toolkit, unfortunately "vehicle" is associated more with cars/automobiles than with generic machines meant for transportation, so I went with "Machinery" instead. But I digress.

                              Airplane is more of a side product from adding simple airfoil model necessary for aerodynamics of rudders and spoilers. I have a better model in works, which would be more realistic for the full wing simulation. It's suppose to be generic enough to get semi-realistic simulation and be able to simulate anything from soaring airplanes to jet powered flying wing. If it's good enough, then one could "design" their own flying tanks or ultra light crafts.
                              Just imagine getting a general look of the machine not from the artist sketch but from functional design - aka how most of the machines are build in the real world. Let's say you want to build a game with various war machines on some alien planet. You can have different athmosphere, gravity, landscape, soil composition and available fuel. All these aspects provide you some basic variables against which you have to design your machines. This way your machines will naturally look different from what we have here on earth and its design will make sense. Something like this was done in Avatar movie - they tried to design their machines in a way that makes sense. I think it's a great approach and provides good base shape of the vehicle.
                              Youtube Channel

                              Comment


                                #75
                                Wow man this is nice, so you added the airplane component from the last 2 post in the repo ?
                                Hevedy - Instance Tools: https://hevedy.itch.io/hevedyinstances
                                Hevedy - Image Tools: https://hevedy.itch.io/imagetools

                                Comment

                                Working...
                                X