Hello, I am fairly new to Unreal 4 and am wondering if there is a way create a duplicated arrangement of a single object. For example, I start with a box and and would like to create an array of that box 3 high, 5 wide and 4 deep. I know an “array” is a programming term in Unreal and that is not what I am looking for. In Maya this can be done using the “Duplicate Special” tool. In Modo you can use the “array” tool. I have searched around and can’t seem to find anything on this. Any ideas? Thanks in advance!
There is a way to do this with a construction script in blueprints. You should look at this: Blueprint Essentials: Using Loops Level Design | 10 | v4.2 Tutorial Series | Unreal Engine - YouTube
Just to offer up some advice, unless you need the large cube to be able to come apart into smaller ones, this is not the best way to get the desired effect.
Dividing one object up to look like this would be less of a lighting nightmare for unreal.
Thanks DelrithInfinity, I will definitely check out that link.
Unfortunately I’m not trying to make that cube design. It’s actually for a grocery store aisle, these are the products sitting on the shelves, so I will need multiple arrays for multiple products. I have noticed that the lighting builds are definitely taking longer creating rows of product like this. If there is a better way to do this please let me know! Thanks!
Well, what might be a good choice, if the objects cannot be lifted from the shelves and be interacted with (i.e, just static props) You could model an entire row of things that look similar.
For example, boxes of pills, instead of placing 6 individual boxes on top of each other in Unreal, just model it once, then duplicate and combine in your modeling software. Maybe make it more realistic by playing with rotation before combining it, since nothing in real life is ever perfectly straight and tidy on shelves.
This is something that you could get with very little extra work, because if you model it once, you should be able to duplicate it a bunch of times, and then place them together in your modeling application in the style you want the stack to look, then just combine the polygons.
Also, I pretty much just said the exact same thing twice in this post haha.
Thanks for the response, I appreciate your help! That process makes sense to me, if the array of products were to never change size. This project is not for a game, its for a store visualization, so I will need to be able to change the layout many times depending on the client needs. Creating an array in my 3d software and re-importing it for every change seems pretty tedious and time consuming to me. Having the individual product imported will allow for an easier re-arrangement when needed.
Ah, Apologies, I assumed it was for a game! Sorry
No problem! I just find it strange that there is no tool for this. What would you do if you were making a church for a game and you wanted 30 pews to be evenly spaced out? Seems like that would take awhile, but I guess, like you said, you could bring them in as a single model as long as they are static meshes.
TIL - The seats in churches are called “Pews”.
Anyways, If I were to be bringing that in for a game, I would spend a little time thinking about it first, but in terms of performance, it should matter a whole lot, since UE4 would only keep one instance in memory, which is awesome.
That said, I would also consider having a mesh with a collection of them just for the sake of making it easier to move around, but thats what groups are for.
A lot of it is down to personal preference, but I personally only create a group of them as one mesh if the collection of the same item share faces or edges with each other, for example, a stack of cigarette boxes, cd cases, crates on top of one another for example. The main reason for this is to make the UV lightmapping work better, because UE4 processes each item separately, and often touching items will be processed on a separate thread.
You follow? Let me know if you have any questions, I am fairly new here aswell, and have learned a lot from the community, so I am always willing to help if I can.
Thanks for all your help LeamDelaney! There doesn’t seem to be an easy way to do this array thing, so I guess I will have to resort to doing it by hand. I checked out the construction scripts DelrithInfinity posted above and, while it was pretty neat, it would take absolutely forever to set up one of those for each product I have on my shelves, which seems counter-intuitive for this specific project.
For now, back to the old dupe and drag. If there are any other suggestions, please let me know! Thanks
No problem, good luck! Don’t forget to post pics when you get it done!
There’s a very easy way to do this - just using a for next loop.
Make a var for rows and one for columns. - Make these both 10 so you end up with a 10 by 10 grid of whatever you’re spawning
Make a for loop from 0 to ROWS.
Plug the loop body execution pin into another loop from 0 to COLUMNS
Plug the execution body pin of that one into a SpawnActorFromClass node.
Then you just need to make a function to define the transform for each SpawnActorFromClass call.
To do this drag left off the transform pin on the SpawnActorFromClass node and choose ‘Make Transform’, then from this new node drag off the location pin and choose ‘MakeVector’
Now you can build a function into the X and Y pins based on the index pins from both your loops.
For example drag off the first index and type multiply to get a multiply node and enter 10 into the second box. (10 is the gap between objects - you should make this a variable too)
Do the same for the other index node.
Plug those values into the X and Y pins of your make vector node.
Don’t forget to wire your first loop into an OnBeginPlay node or something, also you need to actually put an object to spawn into the SpawnActorFromClass node.
Tweak the values and you’ll get the hang of it
Here’s a grab - I just randomly chose DecalActor because I was in a blank project. You’ll want to make a blueprint (even if it does nothing) with your object in it as a static mesh or whatever.
seven years later, thanks!