# Conveyor Belt advice

**URL:** https://discussions.unity.com/t/conveyor-belt-advice/747887
**Category:** Scripting
**Tags:** Scripting
**Created:** [June 20, 2019, 4:25pm UTC](https://discussions.unity.com/t/conveyor-belt-advice/747887 "2019-06-20T16:25:26Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Zalosath](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/zalosath/32/612502_2.png) [@Zalosath](https://discussions.unity.com/u/Zalosath)
#### Post date: [June 20, 2019, 4:25pm UTC](https://discussions.unity.com/t/conveyor-belt-advice/747887/1 "2019-06-20T16:25:26Z")

</div>

Hi there, I’m working on conveyor belts at the moment, and they’re proving to be somewhat of a task.

I initial had the idea for each belt to have 4 different locations at which it could be and just program it to make it look like an item was moving on top, I.E: Have a gameobject move slowly to the next location and then snap immediately back to it’s original location while changing it’s image to the next item on the belt.

However, this has caused some problems, such as corners, such as moving the item in the correct direction. Etc…

I was wondering if you had any suggestions for how I could make this work, the belts are individual gameobjects that are placed in a grid like system, they are 2 “squares” long and 1 “square” wide.

Besides my way, that isn’t working and really sacrifices FPS, could you think of another way to do this? I do not mind if the player moves when on them, that’s not really a necessity.

Thought it might be worth mentioning that the game is 2D.

I’m free to share anything I have so far.

Thanks a lot.

---

<div class="post-metadata">

### Author: ![Stardog](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/stardog/32/910746_2.png) [@Stardog](https://discussions.unity.com/u/Stardog)
#### Post date: [June 20, 2019, 6:16pm UTC](https://discussions.unity.com/t/conveyor-belt-advice/747887/2 "2019-06-20T18:16:35Z")

</div>

> **[Friday Facts #176 - Belts optimization for 0.15 | Factorio](https://factorio.com/blog/post/fff-176)**
>
> Hi everyone. About half a year ago whenever I was sitting deeply in Factorio and when I needed to spend time in my phone, I was reading FFF or Factorio forum. Later when I decided to move - I suddenly realized that Wube is the most logical target to...

> **[Friday Facts #276 - Belt item spacing & Script rendering | Factorio](https://factorio.com/blog/post/fff-276)**
>
> Hello, the office is slowly ramping back up after the Christmas and New year festivities.

> **[Friday Facts #82 - Optimisations | Factorio](https://factorio.com/blog/post/fff-82)**
>
> Hello factorio builders, I hope you enjoy lists and numbers, because you are going to be fed by these today :).

---

<div class="post-metadata">

### Author: ![Zalosath](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/zalosath/32/612502_2.png) [@Zalosath](https://discussions.unity.com/u/Zalosath)
#### Post date: [June 20, 2019, 7:25pm UTC](https://discussions.unity.com/t/conveyor-belt-advice/747887/3 "2019-06-20T19:25:03Z")

</div>

> [@Stardog](#):
>
> [https://factorio.com/blog/post/fff-176](https://factorio.com/blog/post/fff-176)  
> [https://factorio.com/blog/post/fff-276](https://factorio.com/blog/post/fff-276)  
> [https://factorio.com/blog/post/fff-82](https://factorio.com/blog/post/fff-82)

This is good information in terms of the optimisation that I should be doing and some of the underlying functionality I need to provide, but I’m still a bit unsure about how to implement this. I’ve been giving it a think and maybe a Dictionary with connected Conveyor Belts could work, but even then, how do I display the items on the belts.

---

<div class="post-metadata">

### Author: ![Kurt-Dekker](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/kurt-dekker/32/101578_2.png) [@Kurt-Dekker](https://discussions.unity.com/u/Kurt-Dekker)
#### Post date: [June 20, 2019, 7:45pm UTC](https://discussions.unity.com/t/conveyor-belt-advice/747887/4 "2019-06-20T19:45:14Z")

</div>

I think you want to divorce the presentation of the belt graphics from the effect of moving along the belt.

I.e., have a separate test for an item that says “I am on this belt going this way right now,” and accordingly affect its motion: if it’s static, just move it, if it is a player/enemy, then bias its motion towards the belt.

Then you can just graphically engineer whatever kind of belt you want to do: texture scrolling, a series of sprites, a particle flow field, slide-and-snap-return like you said, etc.

In all cases, visual presentation remains completely detached from function, and only concidentally “kept in sync” visually. This approach will result in the least headaches going forward as you tune things like speed.
