Download

UE4 radial damage and radial overlap

This is more of a general scenario rather than damage or overlap, but I’ll take damage as an example.

I dug into some code and saw that** apply radial damage** merely line traces to the [FONT=Arial Black]centre of components that are within a certain radius.



        FVector const TraceEnd = VictimComp->Bounds.Origin;
	FVector TraceStart = Origin;
	if (Origin == TraceEnd)
	{
		// tiny nudge so LineTraceSingle doesn't early out with no hits
		TraceStart.Z += 0.01f;
	}
	bool const bHadBlockingHit = World->LineTraceSingleByChannel(OutHitResult, TraceStart, TraceEnd, TraceChannel, LineParams);
	

If we use this method for calculating hit from say an explosion then if there is a single pixel between the epicentre of damage and the Centre of the hit object it’ll be regarded as **not hit **in the logic.

For example if I had a character mesh with its origin at the waist and a covering wall upto its waist then no amount of radial damage would have any effect on it since it traces to the centre and a straight line path to the centre is blocked by the wall. Even though rest of the mesh is exposed there would be no damage applied.

One of the ways to approximate it is to make a line trace to each of the bones of a skeletal mesh, but what would you do in case of a static mesh?

what is the proper way to have a realistic collision scheme here ?

I actually have the same problem, though I’m not actively working on it at the moment. I think you could use shape traces to trace for a larger area, but that could make other problems appear. Would love to hear solutions!