# How to create hitboxes for objects?

**URL:** <https://forums.solar2d.com/t/how-to-create-hitboxes-for-objects/356097>\
**Category:** Physics\
**Created:** [October 31, 2023, 5:46am UTC](https://forums.solar2d.com/t/how-to-create-hitboxes-for-objects/356097 "2023-10-31T05:46:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![IILLUMINAT](https://forums.solar2d.com/user_avatar/forums.solar2d.com/iilluminat/32/3946_2.png) [@IILLUMINAT](https://forums.solar2d.com/u/IILLUMINAT)\
**Post date:** [October 31, 2023, 5:46am UTC](https://forums.solar2d.com/t/how-to-create-hitboxes-for-objects/356097/1 "2023-10-31T05:46:29Z")

</div>

Hello, I have a problem, there is an object and I want to set a rectangle hitbox for it, respectively, it should be tied to the object not in the center, but with an offset. I know that you can create a polygonal body, that is, you need a table with X and Y coordinates for each point. But I can’t tell by eye at which point of the object I need to specifically make a point. So my question is, is there a way to visually create a polygonal body for an object? I used the PhysicsEditor program, but it results in a lua file where there is no coordinate table as such. Also, I would like to somehow see the hitbox itself that is being created. I can create a shape on top of the old body, but suddenly there is a plugin of some kind. I will be very grateful for your help.

---

<div class="post-metadata">

**Author:** ![XeduR](https://forums.solar2d.com/user_avatar/forums.solar2d.com/xedur/32/256_2.png) [@XeduR](https://forums.solar2d.com/u/XeduR)\
**Post date:** [October 31, 2023, 6:41am UTC](https://forums.solar2d.com/t/how-to-create-hitboxes-for-objects/356097/2 "2023-10-31T06:41:49Z")

</div>

You can use `physics.setDrawMode( "hybrid" )` to see the physics shapes alongside with your regular images, see:

> **[Solar2D Documentation — API Reference | Libraries | physics | setDrawMode](https://docs.coronalabs.com/api/library/physics/setDrawMode.html)**
>
> Solar2D lets you build games/apps for all major platforms including iOS, Android, Kindle, Apple TV, Android TV, macOS, and Windows. Get the free toolset!

For offset rectangular bodies, see:

> **[Solar2D Documentation — Developer Guides | Physics](https://docs.coronalabs.com/guide/physics/physicsBodies/index.html#offsetangled-rectangular-bodies)**
>
> Solar2D lets you build games/apps for all major platforms including iOS, Android, Kindle, Apple TV, Android TV, macOS, and Windows. Get the free toolset!

---

<div class="post-metadata">

**Author:** ![system](https://forums.solar2d.com/uploads/default/original/1X/1bf6a947166df24e92aaa3358558f4b82d7f3d5a.png) [@system](https://forums.solar2d.com/u/system)\
**Post date:** [April 28, 2024, 6:41am UTC](https://forums.solar2d.com/t/how-to-create-hitboxes-for-objects/356097/3 "2024-04-28T06:41:50Z")

</div>

Closed on April 28, 2024, 6:41am UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
