How does one add weakspots to a vehicle?

I cannot figure out how to nor find any guides on the internet on how to add weakspots to an armored vehicle like in world of tanks or armored warfare, does anyone know how I might achieve this?

Hi man ,

if you have a weapon that hit your vehicle, and do an action like explode or just damage the vehicle, add to that event some steps.
Use a raycast to check the exact point where you hit the vehicle, if you want you can check the exact mesh, if your mesh is bigger and you just nneed a weakspot in the middle, save the position of the Bullet/Ray/bomb, at the moment of the add damage .
In the vehiccle add a scene component, and place it where you want the weakpoint.
Be careful that if the mesh part moves, your scenecomponent have to be his child, to be moved with him and follow.
In case of skeletal mesh, you should instead create something to bind to the skeletal bones, because skkeletal meshes dont move/rotate ceasily.
Then Check the distance you want bertween World position of the Weapon exploding/hitting - Worldposition of scenecomponent you added.
Doing a Vector vector and using a get lenght of the vector you can check if
if is < 50 for example you hit that spot, otherwise no

Sorry I am having a little bit of trouble understanding what are you mean. Are suggesting that I use a hidden scene component as a collision mesh or some way of determining the location of the impact?

I am using mostly hitscan weapons like railguns, particle cannon, ect as anti tank weapons. It would probably be very inconsistent if I attempted to make it work for radial damage so I am thinking of just having explosions do a constant but low amount of damage to heavily armored vehicles.

Would anyone know what method of location based damage is used for the tanks is Squad? Something like that could work, not quite War Thunder but adequate.

Just use seperate hitboxes or some basic blueprint to change dmg on hit location.

My problem is that I cannot find a way to import custom collision and even if I did I would still need to know how to add multiple collision meshes to a single object and then determine which one was hit.

As for this suggestion of using blueprints to determine whether the location of the impact is light, medium or heavy armor, would that work for a very complicated armor scheme (weakspots such as the lower plate, turret ring, drivers hatch, ect) or is it just for determining which side of the vehicle was hit?

You can add multiple collision boxes manually in ue4, and blueprint is mostly just for determining what side, however, now that i think of it, you could use box collisions on your blueprints with a custom trace channel/object channel to only respond to bullets, which would also be on another trace/object channel, and depending on which box is hit, do damage based on that

That would be ideal for my project, are there any guides on how to do this? I could not find any, I am somewhat new to game development.

I looked through a lot of options and could not find any “collision mesh” or “hitbox” options in the blueprint editor.

Use Event Point Damage, instead of Event Any Damage, and Apply Point Damage, instead of Apply Damage. With that you can get the hit result, break it, get the hit bone name, location, etc.

I am already using apply point damage and recieve point damage and have implemented a bone based locational damage system for humaniod NPCs, my problem is that I want to add location based damage for tanks which use static meshes, I could just make the tank a skeletal mesh and assign weakspots to bones if I get desperate, but I would rater try and find a cleaner and less horrific way of achieving a location based damage system for vehicles

Physics Materials

and make the damage based on the physical material

you have to go to the project settings and create physical surfaces.

Create physicalMaterials for each section. right click > /physics/physicalmaterial

You have to apply a physical surface to the tank mesh physics asset file per bone physics.

create a function that handles the damage setting based on the physical material hit in the tank

change the damage threshold scale in teh physical material properties/details and set a physical surface type.

create a take damage event that triggers the set damage function.

It all runs off the damage threshold scale set in the physical material details. This threshold is also based on the damage output of the projectile/linetrace. 1 = full damage .1 = 10% damage. I haven’t tried bigger numbers like 2 or 3 but i’m guessing you can make that sectionn “weaker” by upping the damage threshold to 2 or more for double damage taking.

The tank is made up of static meshes (the weakspots are supposed to be sections of these) and I need to be able to precisely control where the weakspot are, so randomly generated collision is not an option.

If you have ever played Warthunder, World of tanks or Armored warfare, that is what I want to try and replicate. I believe there is also a similar system is Squad.

you can take what i mentioned and apply it to each static mesh. i never mentioned a randomly generated collision. if anything the option i provided is as direct control over the damage as possible… but your choice how you want to implement it. good luck!

Oh sorry I did not make it clear enough, I want to add multiple weakspots to a single static mesh.

I use separate meshes for separate components; hull, turret ,tracks, ect, it would be a real mess if I were to have to try and split each one into multiple in order to add weakspots.

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.

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.

So I tried using Bones and weight paint on the tanks model

This 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.
This attained better results.

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.

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

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.