Animating Box Volume

Hello everyone, I have animated the texture of a conveyor belt to look like it is moving and I now am wanting to setup a system that will animate the boxes along the same speed as the conveyor belt so the boxes look like they are being moved by the belt. Can anyone point me in the right direction as to how this can be done? I was thinking of using Blueprint or some sort of physics volume…is that the best way?

After reading the Unreal docs concerning volumes I was wondering if you had ever seen or heard of anyone using NavMesh volumes to create a path for an object like a box to travel on? The theory comes from my thinking of the box as a NPC that the player will interact with. If we assign it an animation of moving forward and then place it on the NavMesh path…shouldn’t it work like a bot?

wouldn’t it be easier if the box is on the belt, make the belt sending an event to tell box it’s on the belt, then just nudge it with direction and speed sent over from belt object until it was off the “on the belt” volume?
(so the box can maintain it’s physics property and player can also interact with it even when the box is on the belt.)

I second this. It sounds like more work to make it look like the box is moving than it would be to just actually move the box.

Hmm…you’re both right. The boxes are supposed to be moving and the player should be able to interact with them. So how does one connect every box to the belt so that the box knows it is on the belt and should be moving? I thought maybe a physics volume with a trigger would accomplish this but I haven’t found the correct set of nodes to get it to work. Can either of you tell me generally how you would go about setting something like this up because right now it seems we are all shooting in the dark with speculations to me. . ? My Blueprint doesn’t produce movement so I can’t say your idea won’t work…but I don’t understand what you’re telling me to do either so some clarification would really help. I do thank you both for helping.

I am not a programmer and am really new to Blueprint but I am trying. I don’t quite understand what you are telling me to do though. If I have multiple boxes coming down the conveyor are you suggesting that I create a separate even for each box telling it that it is on the belt? The boxes vary in shape and size although they are all either square or rectangles if that matters.

The way I see it, it’d be easiest to treat it like a real conveyor belt and not try to work a bunch of magic. Not saying the magic isn’t possible - it is. But if you grab your character’s Movement component and start moving him around, you’re likely to see him start animating, then you’d have to compensate for that. You’d also need a bunch of edge cases for different types of objects that may come into contact with the belt.

Instead, how about spawning a steady stream of marching boxes that you could just stand on or drop objects onto, just like a real conveyor (albeit more like the ones at the airport baggage claim, but those work well, too).

I’ve already done a rough prototype (I’m on vacation today and am about to leave the house - forgive brevity/dirty blueprint):

So here are the components. The important ones are the boxes at start and end. They don’t HAVE to be boxes, mind you. It was just easier for me to visualize.

Here are the variables if you wanna see 'em. The important one is really just the array. The speed thing was for something I didn’t use in this example, but you certainly could hook such a public variable up later, and get it to drive the speed of the texture as well by way of a material parameter.

ConveyorVariables.png

This just spawns another box at the location of the Start box and stores it in an array. On the spawn node, set the collision to BlockAll - you may also want to tweak the scale of the Start so it’s just a hair thicker than the surface of the belt. :slight_smile:

And here’s the meat. At begin play, we spawn our first mover. On tick, we are spawning a new mover every 0.2 seconds, and we are also sliding each mover in X by 5 units. You can incorporate delta if you don’t want this to be slave to computer speed.

Again, this was a really rough proof of concept before I run out the door.

I have tested it, physics objects dropped on it move just fine, as does the character. You can even run against it, if you like. You would have to do some tweaks on your end to taste. I would wire the whole thing to be driven off a single speed variable that also controlled the texture, but this solves the hard part.

Hope it helps!

Real quick - you don’t have to make the boxes super thin, either. You could just make your static mesh not collide, so it becomes more of a decoration or visual effect. Just a thought.

Zak, Man all I can say is you are simply AWESOME brother! I am going to study this so I can wrap my head around it. I did attempt something before reading your post just now…

I know it’s not pretty I only posted this just to show that I was trying and show you why I really appreciate your help! Have a safe and very enjoyable vacation Zak! Cheers!!

Okay Zak,

I am doing my best to dissect what you have done so far, I have created the exact same node layout as your tutorial above and it was a great learning experience to say the least, but I have a couple of questions pertaining to each node if you can elaborate for clarification that would help me retain what I have learned.

This is what I did so far:

QUESTIONS:

1: Spawn Mover= Custom Event…What is this going to connect too and what will it do?

2: Get Relative Transform= attached to Start Box…What is the function of this node in this particular instance?

3: Add Box Component= Will this be used to actually generate my boxes and if so how will I tell it to use my Static Meshes (Boxes I already have)? (Is this the Spawn Node?)

4: ADD= What is the function of this node pertaining to this particular BP setup?

5: Conveyor Array= I am really curious about this node because no matter how many times I deleted it and tried to rename it, it kept making my CO capped in the word “Conveyor Array” upon my pressing ENTER…is that a bug?..Also…what is the function of this node?

And thanks again! I am moving on to attempt to create the next set of nodes…wish me luck :slight_smile: !

Just to make sure - did you read the comment directly under the image for the Spawn Mover custom event? :smiley:

This is just a custom event that is responsible for creating new “invisible marching boxes” and then adding them into an array. Later, we tell every box listed in that array to move along the belt. It’s sorta like an escalator that moves sideways. (Actually, this system would be perfect for in-game escalators… just move at a diagonal vector!)

This is getting the relative transform (location, rotation, and scale) of the Start box, which is at the beginning of the conveyor (left side of the image showing the components). Using the relative transform of that box as the spawn transform for each of the invisible marching boxes means we can just take that start box, position it, and then scale it to the thickness we want all the marching boxes to be. Then, when they’re spawned, they have the same position and size as that start box.

Think of it as a cheat (no such thing, btw) - by doing this, we don’t have to explicitly tell each of these boxes we’re spawning what their position and scales have to be.

No. Your cardboard boxes are your own thing.

What this is doing is creating a stream of those “invisible marching boxes” I mentioned above. Think of them like the panels of a moving walkway like at the airport. They pop in, move to the end of the conveyor, and are destroyed. The cool part is that you can’t see them, but you can stand on them. They slide along and they carry your character with them. Or your cardboard boxes, if you like.

The nice thing about this is that your cardboard boxes can just be static meshes with physics applied to them (check Simulate Physics, but make sure your boxes have a collision surface. Open them in the Static Mesh Editor and choose Collision > 6DOP if they don’t). They can just fall onto the conveyor and they’ll automatically move. When they get to the end, they’ll fall off. Same with your character. She can stand on the conveyor and move with it, or run either with or against it.

This is just adding each of the “invisible marching boxes” to an array the moment it’s created. This is useful because it means that later, we can use a For Each Loop, which is designed to perform some operation on everything stored in an array. In this case, we use it to make all of our invisible boxes start marching down the X-Axis. We also check to see if they’ve reached the End box yet, and if they have, we destroy them.

Yep. That’s a bug. A really, really, REALLY, REALLY annoying one. And according to some of the engineers I’ve spoken with, it’s not a trivial thing to fix because of how we generate the name tables under the hood that drive what’s going on with references to your assets. The only way to work around it is to delete the node altogether and then close and reopen the editor, then recreate it. We’re aware of it and it is on the table to be fixed. It’s just one of those things that - while annoying - isn’t exactly breaking anything. It will be fixed, though.

Hope this helps!

Thank you Zak for getting back to me and yes I did read it…you must forgive me…you have to write it as if you are talking to a complete noob for me to get it the first time around. I do apologize. The breakdown above is REALLY helpful for me and I REALLY do appreciate it!

Your method for solving the problem is genius by the way! There are so many potential uses for this now and I really feel like I have learned something tremendously valuable about the power of Blueprint. Thanks for that Zak!

I went ahead and attempted to recreate the second part of your Blueprint and as you can see I have two issues. On the left and right images I assume the two problems I am having are related. When I went to connect the INTEGER Node FLOAT Nodes popped up and I believe this is because I didn’t know what the two long skinny nodes are that connect the END Node to the BREAK VECTOR Nodes. Can you elaborate on if my assumptions are correct or did I screw up somewhere else?

Okay Zak,
I figured out what the 2 long skinny nodes are…but I am still getting a FLOAT appearing when I try to connect my INTEGER to my BREAK VECTOR nodes.


My question is…with these FLOATS here…will the Blueprint still function the same as yours? If not, what INTEGER are you using?

Hello Zak,
I have 2 questions for you specifically. In the above post you said you would wire the whole thing to be driven off a single speed variable that also controlled the texture, and to that I ask …Where in this Blueprint would you attach the Speed Variable (to what node) so that it can control the texture? The reason I am asking is because I was under the impression that the speed was controlled by the Delay and the Make Vector Nodes math in the Delta Time of the Add Relative Location Node.

My second question my sound like a silly one but can you explain to me how the Spawn a Mover at the BeginPlay knows what to do sine it doesn’t appear to be attached to anything? Still trying to wrap my head around certain aspects of BP.

Disregard this question…it works fine even with the Floats.

Hi Zak,
I’m using the basis of your blueprint to form an escalator and have got it mostly working however my frame rate is dropping like mad and I’m getting this error message. I don’t believe it’s destroying the component at the end, hence overloading. Can anyone offer any help?