# What is the best way to make a if statement that activates when a shape hits the outer part of another shape or as some people may call it the outline

**URL:** https://discourse.processing.org/t/what-is-the-best-way-to-make-a-if-statement-that-activates-when-a-shape-hits-the-outer-part-of-another-shape-or-as-some-people-may-call-it-the-outline/34287
**Category:** Beginners
**Created:** [December 25, 2021, 12:51pm UTC](https://discourse.processing.org/t/what-is-the-best-way-to-make-a-if-statement-that-activates-when-a-shape-hits-the-outer-part-of-another-shape-or-as-some-people-may-call-it-the-outline/34287 "2021-12-25T12:51:35Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![parichko](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@parichko](https://discourse.processing.org/u/parichko)
#### Post date: [December 25, 2021, 12:51pm UTC](https://discourse.processing.org/t/what-is-the-best-way-to-make-a-if-statement-that-activates-when-a-shape-hits-the-outer-part-of-another-shape-or-as-some-people-may-call-it-the-outline/34287/1 "2021-12-25T12:51:35Z")

</div>

Lets say you are making a game where if a moving circle hits a rect it bounces off . Now the hard thing for me is to make the ball to do something if it hits the outline of the shape cause I need to make if x \> x-width/2 (it there a easier way)

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [December 25, 2021, 1:14pm UTC](https://discourse.processing.org/t/what-is-the-best-way-to-make-a-if-statement-that-activates-when-a-shape-hits-the-outer-part-of-another-shape-or-as-some-people-may-call-it-the-outline/34287/2 "2021-12-25T13:14:46Z")

</div>

Hello,

here is an online book: [Collision Detection](http://jeffreythompson.org/collision-detection/point-rect.php)

maybe this can help you

Warm regards,

Chrisir

---

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [December 25, 2021, 1:16pm UTC](https://discourse.processing.org/t/what-is-the-best-way-to-make-a-if-statement-that-activates-when-a-shape-hits-the-outer-part-of-another-shape-or-as-some-people-may-call-it-the-outline/34287/3 "2021-12-25T13:16:46Z")

</div>

[CrHallberg.com/CollisionDetection/Website/circle-rect.html](http://CrHallberg.com/CollisionDetection/Website/circle-rect.html)
