I’m new to building a scene and I was wondering if I’m missing something about placing many items.
I want to place many groceries on shelves, and it’s taking a long time to make things look natural e.g. spaced unevenly + rotated randomly. I have gotten pretty fast at doing it manually but I was wondering if there’s a better way.
I was wondering if procedural generation made sense, but is that overkill for my use case (a small grocery store level) and will it even be less performant than individually placed static meshes?
Procedurally placed meshes shouldn’t be any different from manually placed meshes of the same kind.
If the meshes are not going to move, you’re going to want to use instance static meshes anyway, which is pretty easy to set up procedurally.
What I would do, would be to define some blueprint that can spawn arrays of some mesh in an X/Y grid, with adjustable center-to-center offset, and adjustable amount of random variation in X and Y location and adjustable random rotation. For very fancy, I might even run collision detection such that I made sure no two meshes overlapped after position permutation.
Make the actor have an instance static mesh component. In the actor construction script, delete all previous instances, and re-spawn the meshes based on the seed and permutation parameters of the blueprint.
You could make the area be some editing widget, or just use a plane widget that’s scaled to whatever the coverage area is, and grab its position/size in the construction script.
Another common feature in these kinds of systems is to allow randomly selecting between a few meshes, with different percentage chance. And/or, use something like a material instance parameter to make some of the meshes a little dinged/dented/scruffed.
I’ve got a fast c++ randomized placement system on the market that works really well for this kind of thing, rdBPtools - I’ve got a tutorial on how to stack shelves like that here:
Thank you so much for the detailed reply! If I wanted some of these items to be interactable e.g. a character can pick them up, can I use this method? Or would I use this method for the 90% of items that won’t be interactable and then place them manually like normal for the ones that would be interactable?
In theory, all my products should compile OK on Mac - they work on linux, I just don’t have access to any Mac hardware (would just need to add Mac in the .uplugin file).
If you were interested, and you’ve got XCode installed, I could give you a free copy to try - if it build’s you’re welcome to use it - just email me at rd@recourse.nz if you want.
It is totally possible to build code that allows interacting with static mesh instances.
I built a “wood cutting” system like that before.
The trick is to do interaction detection against the instances of the static mesh, and then suppress those instances and replace them with a real static mesh if you want to “break free” from the static meshes.
If you simulate physics, you could even “merge back” the instance once it reaches physics idle, depending on what specific gameplay you’re interested in.
The main trick is looking up the instance index (“id”) within the instanced static mesh component as part of whatever line trace you’re using to detect interactable objects, so you know which instance to operate on.
One way to “suppress” an instance is to scale it by zero/zero/zero, btw. You don’t need to delete it. And a zero size instance will still have some transform cost, but it has no pixel/screen cost.
Thank you so much for taking the time to respond! That makes sense. Thank you for the documentation link as well.
I also did not know about that instance suppression trick! Or that there are separate transform and pixel/screen costs (I am new to graphics and only have experience with software engineering) but that is good to have in mind.
Hi there! I just got around to trying. I dragged the unzipped plugin folder into a newly created Plugins folder in the root of my project directory (TransLab_NPCRedux 5.3), and tried to open the project in Unreal and am getting the following. For reference, I am on 5.3.2 right now, so maybe that is too recent? I will try building manually now (let me know if you have a go-to strategy for that).
Update – I followed these instructions (with a clean C++ project) and still no luck, I will look for another guide but in the meantime, I might try using one of the university’s computers.
It sounds like there are errors during compilation so there must be some difference in code needed between Mac and Windows/Linux - I really need to save up and get a Mac to test on!
In the meantime, is it possible to set up a scene with this plugin on a Windows machine, and have the actors persist somehow if I were to transfer the project back to a Mac machine?
Good to know re. the transfer – is there a way to convert blueprints back out of the system your package uses to manage them in case that wouldn’t work?
In the meantime, I will try it on the Windows machine and then try importing it back to my Mac.