# .setDrag Doesn't Work When Object Is Added to A Group

**URL:** <https://phaser.discourse.group/t/setdrag-doesnt-work-when-object-is-added-to-a-group/5529>\
**Category:** Phaser 3\
**Created:** [March 16, 2020, 3:16pm UTC](https://phaser.discourse.group/t/setdrag-doesnt-work-when-object-is-added-to-a-group/5529 "2020-03-16T15:16:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![UltimateProGrammer](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/ultimateprogrammer/32/3069_2.png) [@UltimateProGrammer](https://phaser.discourse.group/u/UltimateProGrammer)\
**Post date:** [March 16, 2020, 3:16pm UTC](https://phaser.discourse.group/t/setdrag-doesnt-work-when-object-is-added-to-a-group/5529/1 "2020-03-16T15:16:46Z")

</div>

Hello,  
I have made a physics group called `poCars`. I have also made a game object with the name `poCar`. I want to add the `poCar` game object to the `poCars` group, for collision. Everything works fine except that `.setDrag(1000, 1000)` doesn’t work. Drag works fine when I don’t add `poCar` to the group. I am using Phaser 3.22.0, with Arcade Physics. Here is a code example:

var poCars = this.physics.add.group();  
var poCar = this.physics.add.sprite(7772, 48, ‘policeCar’).setScale(1.5).setDrag(1000, 1000);  
poCars.add(poCar);  
this.physics.add.collider(poCars, player);

The above does increase the _scale_ of the `poCar` but does not set _drag_. However, if you just simply comment out `poCars.add(poCar);` and change `this.physics.add.collider(poCars, player);` to `this.physics.add.collider(poCar, player);` (Removing the s in poCars) the drag works again.

Is this a glitch or is there an issue with how I’m doing this? Can you think of a better way to call an overlap function when a member of a group is overlapping a player, and have each child of the group have drag?

One possible solution to this is to iterate over each child of the group and set its drag but I have not tried that yet. Should I?

I know that this is pretty long and confusing because all of the variable names are so similar, so if you have a question feel free to ask.

Thanks,  
Ultimate Pro Grammer

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [March 16, 2020, 3:31pm UTC](https://phaser.discourse.group/t/setdrag-doesnt-work-when-object-is-added-to-a-group/5529/2 "2020-03-16T15:31:37Z")

</div>

Add the sprite to the group, then modify the sprite.

A physics group has default physics settings it applies to its members. The default drag is 0.

---

<div class="post-metadata">

**Author:** ![UltimateProGrammer](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/ultimateprogrammer/32/3069_2.png) [@UltimateProGrammer](https://phaser.discourse.group/u/UltimateProGrammer)\
**Post date:** [March 16, 2020, 4:09pm UTC](https://phaser.discourse.group/t/setdrag-doesnt-work-when-object-is-added-to-a-group/5529/3 "2020-03-16T16:09:57Z")

</div>

Thank you for the explanation. I could not figure out how to do it, and it was so simple! I ended up iterating over each child so that I didn’t have to declare any variables.
