I am currently implementing explosive damage to our characters. Our character follow typical DCC methods of a single skinned mesh over a bone hierarchy. During editing inside the UE, the artists define a logical set of groupings for the bones to split the character into sub-elements, such as left leg, right leg, left arm, etc.
To implement radial damage due to explosions in the immediate vicinity, we collect the logical components and the groups of bones assigned to each logical component. We average the location of the bones into a single average location. We then use this average location for the logical component to trace back to the origin of the explosion. We check for hits closer to the logical location than the origin of the explosion. If a hit result is closer than the origin of the explosion, the trace is terminated as if the logical component was blocked by objects between the logical component and the explosion.
In the above image, the large red circle is representing the explosion while the small red circles represent the average location of a logical component. Hopefully, it is easy to see how the right side of the upper body is full exposed to the explosion as the traces do not intercept any intervening mesh surfaces. Logical components on the left side of the upper body would be protected by the torso being between them and the explosion.
My question is this: Is this the most efficient way to implement this type of design? It works reasonably well as our average logical location is computed from the animated positions, allowing a fully dynamic response during runtime. Any suggestions to our implementation would be greatly appreciated as the current design would likely become a burden if dozens of explosions occurred in a single pass.
This is highly simple. I have to guess your using blueprints so I can’t help. I suggest you sit a minute and think because I say again what you’re trying to do very very simple
I hate to give you this answer but it’s the best way to answer. Your solution isn’t code in unreal engine side i say that maybe there might be handlers for you. as far as raw code you need to compose a algorithm.
The type of algorithm as far as most efficient implementation is what I’m interested in. As far as the details of implementing any specific algorithm I can manage. I am looking at a generalized discussion of other ideas on how to implement occlusion culling for radial explosions.
I redefined our criteria to better insulate the artists from any gritty details and the implementation works extremely well. I have optimized at every level to achieve the best speed possible with the latest iteration of our design. The coding side is not the concern. Its the design side that has my interest. I understand the details of how to implement an occlusion detection system in Unreal using overlaps, sweeps, and traces to cull any mesh sections not visible from a specific location.
Our current design relies on the artists manually splitting the character mesh into the constituent body parts where there are assigned to UPROPERTY SkeletalMeshComponents within the character class. During a radial explosion, all primitive components are checked for overlap and each given a radial force impulse. During the for loop processing of the overlapped primitive components, the component owner is cast to a custom interface for a damageable object, character, weapon emplacement, etc., that can receive damage. If the cast is successful, then the OnDamage method implemented by the derived interface class is called. For a character the OnDamage method checks radial damage. If the input damage is a radial damage then the character gathers the internal body components and begins to check for being occluded from the origin of the explosion.
To check for a body component being visible, I implemented a custom cone trace algorithm that uses a simple multicast design that traces a jittered set of sample traces along the axis of the cone. If any trace returns a blocking hit on the body component then the component is returned as visible. If the body component is deemed visible by the cone trace then damage is applied to the component.
The advantage of this design is that any blocking mesh in the world can prevent damage from being applied to character’s body, such as a wall or even another character being closer to the explosion.
The disadvantage of this design is the worst case scenario where the entire character is hidden and all internal traces have to search through all possible traces on all body components. This is where I am most interested in finding a large scale occlusion algorithm that can accurately determine if the whole character is visible from any location on the map. These locations are not view aligned so the typical unreal occlusion methods are not sufficient.