Free Procedural HISM Placers
Hey guys, I got a lot of positive response from my last two posts ( 1 & 2 ) about using HISMs to improve performance, so I thought I’d give you guys a couple of the utility classes I’m using in my game UFO Rodeo to procedurally place the meshes and save myself some time and performance. There’s currently 4 HISM placers and they are all built on the actor class with no references to external code, so just copy them into your Unreal project and UE4 should pick up on the changes when you boot it.
On each of these actors you’ll find a hierarchical instanced static mesh component. Set the mesh on that component to the one you want to use, fill out the parameters under the “Stats” section and you should be good to go. Some of the actors have a section of parameters marked “Stamp”. Turning on Stamp will stamp your meshes to whatever is under them. so for instance if the floor is uneven in the level you are working on just put this actor hovering over the ground and turn stamp on and it will stamp to the floor, wherever that is. Note that it will even work in conjunction with vertical offset parameters. Feel free to go through the code and let me know of anything you think I could improve. I’ll go over some of the specifics of each class below.
Edit: These plugins are only compatible from 4.17 onward.
Warning: As of the writing of this post UE4 17.0 is acting finicky about anything done in the construction script from what I can tell. Instances now wait to spawn till the game is either started or you run simulate. Also I’m getting some crashes when I try to move the root. But these problems only seem to exist in 17.0 and epic is usually good about putting out fixes for this kind of stuff quickly.
The manual placement HISM actor works by creating an array of transform gizmos, that can be moved around and placed by hand. The Blueprint then spawns an instance at each transform. This is a good catch-all actor that allows you to place HISMs by hand. The pillars in the above image are all part of a manual placement actor.
This class contains a spline component that can be shaped in the editor. It then spawns instances along the path. This includes the stamping functionality, so you don’t need to be precise with your height.
This class spawns instances in a circle around the center of the actor. You can change the number of meshes and the radius of the circle.
The scatter placer takes a radius and a number of meshes similarly to the circle placer, but this one spawns anywhere within the circle, not just the outer edge.
Anyways go ahead and try these out and let me know what you think of them.