Announcement

Collapse
No announcement yet.

How does one add weakspots to a vehicle?

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

    #16
    Originally posted by MindfieldsTech View Post

    Hmmmm Your best bet then is to convert those static meshes to skeletal meshes, then that opens your world up to adding the individual collisions to each mesh in the physics properties the way I showed you.

    so instead of having the tank built up from static meshes, your process will be the same but instead the pieces will be skeletal meshes.
    Well I suppose I will try that tomorrow.

    Do you by any chance know of how to import custom collision meshes for the bones? I am perhaps a little bit of a perfectionist and preffer to model such things myself as opposed to letting the computer attempt to approximate what I want.

    Anyway Thank you for the help.

    Comment


      #17
      Originally posted by Mikhail-N View Post

      Well I suppose I will try that tomorrow.

      Do you by any chance know of how to import custom collision meshes for the bones? I am perhaps a little bit of a perfectionist and preffer to model such things myself as opposed to letting the computer attempt to approximate what I want.

      Anyway Thank you for the help.
      I think When you are inside the physics asset for that mesh you can add collisions the same way as you do in static mesh collision. you can add box, sphere capsule etc. I hope that answers your question. Good Luck!

      Comment


        #18
        Originally posted by MindfieldsTech View Post

        I think When you are inside the physics asset for that mesh you can add collisions the same way as you do in static mesh collision. you can add box, sphere capsule etc. I hope that answers your question. Good Luck!
        Oh I meant importing meshes from blender to use as collision meshes, tank armor layouts can get rather complicated and if the collision mesh does not match the model then players can get very annoyed if they notice a shell or particle stream going straight through part of a tan and not doing any damage or thier tank receiving damage from what should have been a near miss.

        It would be very difficult to approximate the armor of a tank with boxes and capsules, I have used the option to generate a collision mesh based on the objects geometry and it works, but I lack fine control over it.

        Comment


          #19
          So I tried using Bones and weight paint on the tanks model
          Click image for larger version  Name:	CorporateLightTank.1.3blendCollsionTest1.png Views:	0 Size:	564.5 KB ID:	1791789This Resulted in a tangled mess when I tried to generate collision for it in UE4 so I created a new mesh around it that was split up into segments in order to try and avoid this issue.
          Click image for larger version  Name:	CorporateLightTank.1.3blendCollsionTest.png Views:	0 Size:	554.8 KB ID:	1791790This attained better results.
          Click image for larger version  Name:	ScreenShot00004.png Views:	0 Size:	424.5 KB ID:	1791791
          I then ran into the problem that no matter what I did the collision meshes generated would not properly conform to the mesh making it difficult to target certain components as an invisible collision mesh would be in the wat and what I had was now a skeletal mesh that existed solely to be used to contain collision data for another mesh and it was all a clossal pain to get all of this done.

          Is there any way I can simply just add custom (ones that I can model and import) collision components to a mesh or blueprint ? It would be quite odd for UE4 to not have this feature.
          Last edited by Mikhail-N; 07-23-2020, 11:52 AM.

          Comment


            #20
            Hi, you already got a couple of working solutions described in the posts above =)

            (1) Add scene components (or anything that can be referenced) to your tank where you want the weakspots. So each scene component would be a weakspot. Then when the tank gets hit get the distance between the hit location and each scene component. If the hit location is closer than X distance to a scene component, then you've hit a weakspot. You could create a map that maps from the weakspot to the distance X, so each weakspot could have a different radius

            -easy to setup
            -you basically got spheres as weakspots then

            (2) Add collision boxes/shapes or custom meshes as collision to your tank and use those for collision with projectiles (or whatever it is you use to do the damage). Then depending on which collision object you've hit, you deal different damage to the tank.

            -can be more accurate since you can also place other shapes than spheres, might be a bit heavier on performance though
            -you will then need to setup a system that maps from the collision object that has been hit to the damage/damage factor

            Is there any way I can simply just add custom (ones that I can model and import) collision components to a mesh or blueprint ?
            Import your custom meshes, add them to your tank blueprint and then use them for collision with your projectiles (Hit Component inside the Hit Result).

            (3) Use a skeletal mesh and add physics assets as collision to it (something similar to (2)). Then when you hit the tank get the bone name and deal different damage based on what bone you've hit.

            -similar to (2), but you can directly get the bone name in the hit result, so no need to implement that manually you can directly read the damage/damage fac from a map you've made once

            (4) Use a physical material mask (I never done this). If you hit something then you can get the physical material in the hit result. Seems that with a physical material mask you can apply several physical materials to your material. Then based on what physical material you've hit, you can deal different damage.

            -you will need to create the textures for the mask, so setting this up will need some work
            -will be most accurate in combination with complex traces


            Keep in mind you don't need to make this too accurate, only as accurate that the player does not has the feeling that something is wrong.

            Comment


              #21
              Personally I use skeletal mesh in combination with physics asset collisions and physical materials. Break the hit result -> phys mat + bone.

              Comment


                #22
                Originally posted by chrudimer View Post

                (4) Use a physical material mask (I never done this). If you hit something then you can get the physical material in the hit result. Seems that with a physical material mask you can apply several physical materials to your material. Then based on what physical material you've hit, you can deal different damage.

                -you will need to create the textures for the mask, so setting this up will need some work
                -will be most accurate in combination with complex traces

                Keep in mind you don't need to make this too accurate, only as accurate that the player does not has the feeling that something is wrong.
                Ah OK so that is how you are supposed to do it, can this be done on a static mesh?

                I already use a system based on what scene component was hit for determining when the weapons are hit and I hate texturing so I guess I will use suggestion 3 (I did create a system like 3 before but it would sometimes let projectiles go all the way through it without registering a hit though this was probably just me incorrectly setting up the collision.)

                So I guess if the proper way involves textures I will be using the alternate way.

                Comment


                  #23
                  I don't know whether or not it is the "proper" way, but physical materials work on anything where you apply a material. So it can be done with a static mesh. When you break the hit result -> phys mat, that will give you the physical material you've hit.

                  Normally you can only have one physical material per material (no texture needed here, you just specify what physical material you want). Since that may be a limitation, with a physical material mask you're supposed to be able to have several different physical materials applied to one material. But then of course you would need to specify where they are, and apparently you would do that via a texture. But I never used a physical material mask.

                  Comment


                    #24
                    simply put, you can add small colliders where you want "weakpoints" in the BP class, so "onhit" something happens to the vehicle

                    Comment

                    Working...
                    X