# Loop created objects with physics impostors have issues

**URL:** https://forum.babylonjs.com/t/loop-created-objects-with-physics-impostors-have-issues/2204
**Category:** Questions
**Created:** [March 28, 2019, 11:41am UTC](https://forum.babylonjs.com/t/loop-created-objects-with-physics-impostors-have-issues/2204 "2019-03-28T11:41:06Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Givo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/givo/32/4968_2.png) [@Givo](https://forum.babylonjs.com/u/Givo)
#### Post date: [March 28, 2019, 11:41am UTC](https://forum.babylonjs.com/t/loop-created-objects-with-physics-impostors-have-issues/2204/1 "2019-03-28T11:41:06Z")

</div>

In my game I am using spheres with physics as like a teleport mechanism. Here is the playground: [https://www.babylonjs-playground.com/#Z0QW21#29](https://www.babylonjs-playground.com/#Z0QW21#29)

An issue I am having is that the shot spheres can’t collide with each other, and on other thing. But first, here is a rundown of the playground.

Use the mouse to look around and left click to shoot. You will be teleported to where the ball landed. Line 98 creates the ball, and the pewpew function after it is called when you left click. It restates the variable, so it makes another ball. At lines 260-268 it detects when the ball hits the ground and destroys the ball, and teleports you to where it landed.

Ok. so the first issue is look straight down and spam left click. I mean fast! eventually some balls will bunch up, move slow, not collide with each other, and don’t teleport you.

The second is that only the last ball can teleport you. shoot one straight and then shoot one forward. only the last ball will teleport you. Can this not happen.

Thanks for any help.

Givo

---

<div class="post-metadata">

### Author: ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)
#### Post date: [March 28, 2019, 2:31pm UTC](https://forum.babylonjs.com/t/loop-created-objects-with-physics-impostors-have-issues/2204/2 "2019-03-28T14:31:01Z")

</div>

Summoning @trevordev

---

<div class="post-metadata">

### Author: ![trevordev](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/trevordev/32/16_2.png) [@trevordev](https://forum.babylonjs.com/u/trevordev)
#### Post date: [March 28, 2019, 6:06pm UTC](https://forum.babylonjs.com/t/loop-created-objects-with-physics-impostors-have-issues/2204/3 "2019-03-28T18:06:02Z")

</div>

the filtering group needs to be set on the ammo to also collide with the ammo [https://www.babylonjs-playground.com/#Z0QW21#30](https://www.babylonjs-playground.com/#Z0QW21#30)

If you want all the balls to teleport you, you will need to create an array of them and iterate over all of them in your update loop

---

<div class="post-metadata">

### Author: ![Givo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/givo/32/4968_2.png) [@Givo](https://forum.babylonjs.com/u/Givo)
#### Post date: [March 28, 2019, 6:19pm UTC](https://forum.babylonjs.com/t/loop-created-objects-with-physics-impostors-have-issues/2204/4 "2019-03-28T18:19:22Z")

</div>

Thanks for the help!

This will do nicely. 😉

---

<div class="post-metadata">

### Author: ![Galen](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/galen/32/539_2.png) [@Galen](https://forum.babylonjs.com/u/Galen)
#### Post date: [March 28, 2019, 9:02pm UTC](https://forum.babylonjs.com/t/loop-created-objects-with-physics-impostors-have-issues/2204/5 "2019-03-28T21:02:44Z")

</div>

I haven’t looked at your scene, but based upon the post it sounds as though cloned meshes and impostors might work for you. This has always been a reliable method to generate different geometry and physics objects.

Galen

---

<div class="post-metadata">

### Author: ![Givo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/givo/32/4968_2.png) [@Givo](https://forum.babylonjs.com/u/Givo)
#### Post date: [March 28, 2019, 11:34pm UTC](https://forum.babylonjs.com/t/loop-created-objects-with-physics-impostors-have-issues/2204/6 "2019-03-28T23:34:46Z")

</div>

I have tried an instanced mesh but not a cloned one. I’ll give it a try. maybe it might fix another issue that I’m having.

Btw, for the longest time I thought darth sidious was your profile pic.
