# Just one collision or "hit"

**URL:** <https://phaser.discourse.group/t/just-one-collision-or-hit/11293>\
**Category:** Phaser 3\
**Created:** [February 22, 2022, 3:11am UTC](https://phaser.discourse.group/t/just-one-collision-or-hit/11293 "2022-02-22T03:11:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GerardoBarraganInigu](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/gerardobarraganinigu/32/6235_2.png) [@GerardoBarraganInigu](https://phaser.discourse.group/u/GerardoBarraganInigu)\
**Post date:** [February 22, 2022, 3:11am UTC](https://phaser.discourse.group/t/just-one-collision-or-hit/11293/1 "2022-02-22T03:11:26Z")

</div>

Hello! I’m trying to make my character hit enemies. I Created a rectangle which I use as a hitbox and when I attack I activate its physics so that it collides with the enemy, everything works almost fine only that when I press the attack key it collides more than once I don’t know why. What I did was activate the body of the rectangle only in a specific frame of the animation and deactivate it in the next frame, I thought that would be enough but no, several hits are still detected, please help me, I have been trying to solve this for days.

[https://global.discourse-cdn.com/free1/uploads/phaser1/original/2X/9/9fe54d4c6490f993ada69fc3934110a08bb932e7.mp4](https://global.discourse-cdn.com/free1/uploads/phaser1/original/2X/9/9fe54d4c6490f993ada69fc3934110a08bb932e7.mp4)

---

<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:** [February 22, 2022, 4:42pm UTC](https://phaser.discourse.group/t/just-one-collision-or-hit/11293/2 "2022-02-22T16:42:10Z")

</div>

One animation frame usually lasts for several physics steps.

Disable the physics body after the first hit.

---

<div class="post-metadata">

**Author:** ![GerardoBarraganInigu](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/gerardobarraganinigu/32/6235_2.png) [@GerardoBarraganInigu](https://phaser.discourse.group/u/GerardoBarraganInigu)\
**Post date:** [February 22, 2022, 5:23pm UTC](https://phaser.discourse.group/t/just-one-collision-or-hit/11293/3 "2022-02-22T17:23:57Z")

</div>

@samme How would you know when the first hit was?

---

<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:** [February 22, 2022, 9:09pm UTC](https://phaser.discourse.group/t/just-one-collision-or-hit/11293/4 "2022-02-22T21:09:49Z")

</div>

Use the collision callback.
