# Is there something like getGameObjectsWithinShape

**URL:** <https://phaser.discourse.group/t/is-there-something-like-getgameobjectswithinshape/13406>\
**Category:** Phaser 3\
**Created:** [July 10, 2023, 7:21pm UTC](https://phaser.discourse.group/t/is-there-something-like-getgameobjectswithinshape/13406 "2023-07-10T19:21:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NetForceOne](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/netforceone/32/7649_2.png) [@NetForceOne](https://phaser.discourse.group/u/NetForceOne)\
**Post date:** [July 10, 2023, 7:21pm UTC](https://phaser.discourse.group/t/is-there-something-like-getgameobjectswithinshape/13406/1 "2023-07-10T19:21:01Z")

</div>

Good day,

I am still pretty new to Phaser 🙂  
Is there a Method similar to `layer.getTilesWithinShape(shape);` but just for gameObjects?  
something like `scene.getGameObjectsWithinShape(shape)`

i was just wondering and didn’t find anything close.

i want to check if any GameObject is Touching a Line Between the Player and the Enemy.

Thank you 😃

---

<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:** [July 11, 2023, 1:25am UTC](https://phaser.discourse.group/t/is-there-something-like-getgameobjectswithinshape/13406/2 "2023-07-11T01:25:12Z")

</div>

There isn’t. You can convert game objects to rectangles and use the [Intersects](https://newdocs.phaser.io/docs/3.60.0/Phaser.Geom.Intersects) methods. See

> [@Test intersection of two game objects (Phaser 3)](https://phaser.discourse.group/t/test-intersection-of-two-game-objects-phaser-3/8021):
>
> You can do this without physics. You copy the bounds of the game objects to rectangles and then use the [Phaser.Geom.Intersects](https://photonstorm.github.io/phaser3-docs/Phaser.Geom.Intersects.html) methods. Recycling the rectangles is efficient. Most game objects have two boundaries, possibly distinct: [Phaser.GameObjects.Components.GetBounds#getBounds()](https://photonstorm.github.io/phaser3-docs/Phaser.GameObjects.Components.GetBounds.html#getBounds) and [Phaser.Display.Bounds.GetBounds()](https://photonstorm.github.io/phaser3-docs/Phaser.Display.Bounds.html#.GetBounds). If you’re not interested in transforms then GetBounds() is faster. [Phaser.Geom.Intersects.RectangleToRectangle()](https://photonstorm.github.io/phaser3-docs/Phaser.Geom.Intersects.html#.RectangleToRectangle) tells you whether the rectangles intersect at all, and [Ph…](https://photonstorm.github.io/phaser3-docs/Phaser.Geom.Intersects.html#.GetRectangleIntersection)
