# Tilemap collisions not working when generated by a factory (DEF-3758) (SOLVED)

**URL:** <https://forum.defold.com/t/tilemap-collisions-not-working-when-generated-by-a-factory-def-3758-solved/41527>\
**Category:** Bugs\
**Created:** [January 25, 2019, 5:57pm UTC](https://forum.defold.com/t/tilemap-collisions-not-working-when-generated-by-a-factory-def-3758-solved/41527 "2019-01-25T17:57:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Melix19](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/melix19/32/13711_2.png) [@Melix19](https://forum.defold.com/u/Melix19)\
**Post date:** [January 25, 2019, 5:57pm UTC](https://forum.defold.com/t/tilemap-collisions-not-working-when-generated-by-a-factory-def-3758-solved/41527/1 "2019-01-25T17:57:17Z")

</div>

I want to create a tilemap in which its tiles are generated in runtime and in which the tilemap itself is generated in runtime by a factory. The problem is that if I try to generate a tilemap with the factory, the tilemap collisions don’t work, but if I try to instantiate the tilemap in the collection without using the factory, the collisions work.

Defold version: 1.2.145  
OS: macOS 10.14.2  
Link to a project to simulate this bug: [MEGA](https://mega.nz/#!yGR12aKC!BNsN_PJB89oqW7rxKMaSaZGaIOCHmKDOz1WGxSK2usc)  
There are two collection in this project that you can choose to run: factory.collection for testing the bug and instantiated.collection to demonstrate that the collisions work if the tilemap is not generated by a factory.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [January 25, 2019, 6:32pm UTC](https://forum.defold.com/t/tilemap-collisions-not-working-when-generated-by-a-factory-def-3758-solved/41527/2 "2019-01-25T18:32:45Z")

</div>

Yes, this does indeed look like a bug. I guess it is a combination of spawning the tilemap using a factory and then using set\_tile() to populate the tilemap with tiles that causes the collision shape to not update properly. @Johan_Beck-Noren, @sven, @jhonny.goransson, can you confirm?

Attached project here:

[Collision Bug.zip](https://forum.defold.com/uploads/default/original/2X/3/3364ac69e3b36d40f2f1c0ed02f315d36f9f7a0a.zip) (70.9 KB)

---

<div class="post-metadata">

**Author:** ![Melix19](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/melix19/32/13711_2.png) [@Melix19](https://forum.defold.com/u/Melix19)\
**Post date:** [February 3, 2019, 2:07pm UTC](https://forum.defold.com/t/tilemap-collisions-not-working-when-generated-by-a-factory-def-3758-solved/41527/3 "2019-02-03T14:07:54Z")

</div>

Any update on this?

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [February 3, 2019, 4:09pm UTC](https://forum.defold.com/t/tilemap-collisions-not-working-when-generated-by-a-factory-def-3758-solved/41527/4 "2019-02-03T16:09:25Z")

</div>

No, no update. We plan our next sprint (two weeks of work) tomorrow (Monday). We will evaluate and prioritise this issue during our planning session.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [February 4, 2019, 8:13am UTC](https://forum.defold.com/t/tilemap-collisions-not-working-when-generated-by-a-factory-def-3758-solved/41527/5 "2019-02-04T08:13:12Z")

</div>

Created DEF-3758

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [March 4, 2019, 6:42am UTC](https://forum.defold.com/t/tilemap-collisions-not-working-when-generated-by-a-factory-def-3758-solved/41527/6 "2019-03-04T06:42:51Z")

</div>

7 posts were split to a new topic: [Removing tiles from tilemap updates collision shape but does not affect objects at rest (DEF-3810)](https://forum.defold.com/t/removing-tiles-from-tilemap-updates-collision-shape-but-does-not-affect-objects-at-rest-def-3810/45252)

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [February 18, 2019, 9:21pm UTC](https://forum.defold.com/t/tilemap-collisions-not-working-when-generated-by-a-factory-def-3758-solved/41527/7 "2019-02-18T21:21:47Z")

</div>

Released in Defold 1.2.147
