# How to distinguish between 2 game objects built by a factory?

**URL:** <https://forum.defold.com/t/how-to-distinguish-between-2-game-objects-built-by-a-factory/3764>\
**Category:** Questions\
**Created:** [December 23, 2016, 2:09am UTC](https://forum.defold.com/t/how-to-distinguish-between-2-game-objects-built-by-a-factory/3764 "2016-12-23T02:09:40Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [December 23, 2016, 9:18am UTC](https://forum.defold.com/t/how-to-distinguish-between-2-game-objects-built-by-a-factory/3764/2 "2016-12-23T09:18:00Z")

</div>

First off, you need to detect _which_ object you clicked on. You can do that by iterating through your spawned objects and do a simple [radius check](https://forum.defold.com/t/detecting-click-zone-on-game-object-like-gui-pick-node-solved/1684/2) since you are using spheres.

When you have that object, you can send the force to it. E.g.

```lua
local object_hash = factory.create( ... )
...
msg.post(msg.url(nil, object_hash, "collisionobject"), "apply_force", {force = ... })

```

---

_[View the full topic](https://forum.defold.com/t/how-to-distinguish-between-2-game-objects-built-by-a-factory/3764)._
