Download

Tornado: Detection of Foliage & Performance Issue

I’ve created a tornado actor for a game I’m working on.

The current way I’m detecting the presence of nearby foliage to destroy is by doing a multi sphere trace by channel at the base of the tornado, and then taking every overlap it returns and taking appropriate action against that instance of the instanced static mesh on the map. It moves the instance out of the way, replaces it with an identical looking actor that has physics enabled, and tosses it in the air.

The problem is, this multi sphere trace is causing a very noticeable stutter every time it runs (it’s currently on a 1.5 second clock). When I collect logs and view them in Session Frontend, I can see by far the largest computation UE4 is doing is this multi sphere trace, and the actor spawning and physics simulation of the replacement debris is actually quite low in comparison.

I haven’t been able to come up with any other methods for detecting nearby foliage for the tornado. I’ve tried attaching a collision sphere to the tornado and getting all overlapping components, but that doesn’t return an index into the instanced static mesh. I’ve also tried setting up a collision sphere to detect hit events, but, without a character movement component, the collision sphere will not ever generate hit events. I’m running out of ideas on alternative ways to detect nearby instanced static meshes for the tornado that may be less of a performance hit than my current method.

Any ideas?