how to animate a conveyor belt

Hey Unity Community!,

I’m pretty new to 3d graphics programming (10-yrs as a programmer, just not with 3d gfx). I’m currently in the process of starting with some simple as more of a learning exercise than anything.

I intend to model a simply conveyor belt. This conveyor belt will consist of two cylinders (one at each end) which are connected by the belt itself (the belt wraps around the cylinders).

I have a few questions on how I should go about modelling this. Any suggestions would be great:

a). I am able to successfully model a simple mesh for this in blender, and import it into Unity. Is there a way I can control how the mesh scales in Unity? I wish to scale just the length of the belt, leaving the exact size of the cylinders intact. Creating different sizes of the same mesh (where only the length of the belt changes) in Blender seems counter-intuitive.

b). I’d like to texture map the belt and eventually animate the belt so that the belt moves (i.e. the conveyor is ‘on’). I guess I would do this by deforming the vertices of the belt so that all the belt vertices rotate, adhering to the belt shape). Can this be done in blender via key-framing, or should I implement this through a script in Unity?
The key-framing solution is preferable, however not sure if this can be done, as the vertices are rotated around the mesh, NOT the mesh rotated around a single point.

I hope the above is a clear enough explanation of my thought processes. Any pointers would be great guys…

You can scale along one or more axes easy enough, but in doing so you have to realize that you’re going to distort the belt model as it will be “thicker” along the axes you scale up compared to those that you don’t scale. Why not model it to the exact size you need?

You can’t keyframe animation of verts, only of the entire model. So the keyframe option is only viable if you have a circular belt as then you can keyframe a basic rotation, otherwise you’re going to need to use scripting inside of Unity.

Hey Higgy,

Thanks for helping out,

Yes, I’m thinking this maybe best solution available.
I’d like several different conveyor belts all of different sizes so I guess I can model these in Blender and create a pre-fab for each one.

I thought perhaps I was missing something like a flag in unity per-mesh. something like (scale with parent) which I could turn off for the cylinders (cylinders being children of the belt). At least then then cylinder positions would change correctly, yet retain their scale. I haven’t looked into it yet, but I hope blender has something like this, so will save me tons of time to create the different sizes.

Ah ok, I thought so. I’ll look into this some more.

Thanks for your help and if anyone else wants to contribute please do.

1 Like

Seems to me that rather than physically animating the belt, it would probably be sufficient to use UV animation in this case.

–Eric

I think it would be worth trying UV animation here.

Like Tom said, you can’t animate vertices in Unity except through scripting, but you probably wouldn’t want to do that anyway. In most cases animating the offset of the texture of the belt can give a good enough illusion. That is also currently something you have to do through scripting, but it is considerably simpler than moving the vertices.

Note that no matter if you choose to animate the actual vertices or just the texture offset, the belt will not work out of the box with physics, i.e. it won’t actually move things on top of it. There are several solutions for this, but I’m not sure which one is actually simplest to implement. Maybe someone who have actually done it can pitch in.

Rune