Round/circle hitboxes

Quick question:
Is it possible to make hitboxes round/circle/with smooth corners?
I want to make some circles.

If that is not possible, is it possible to take the outline of a png image, and make that the hitbox?

Thanks

2 Likes

it isn’t possible to use a png file as hitbox. but you can use the bult-in hitbox system. just push the “use a custom collision mask” button. this will erase the default (auto) hitbox. than you can create a new polygon mask. it has 4 points by default, but you can add more.

1 Like

But is there a way to make round corners? Making a smooth circle is almost impossible with the points-system.

2 Likes

nope. you couldn’t create round corners in the hitbox. but you dont need a perfect shape as a hitbox. I think, for a hitbox is a 12 corner circle is enough.

you can add more if you want, but it’s unnecessary. but this is just my opinion.

2 Likes

Only Physics 2 has round hitbox for now.

2 Likes

There is a PR adding round collision abandoned that Lizard had began working on. If a contributor is interested they could finish it and merge it

1 Like

possible but to make a perfect circle would be hard(u would need alot of the the hitbox points)

1 Like

i was wondering from the start, why there are no round hitboxes.
when it comes to coding, round hitboxes are the easiest to do, with the least performance required (at least in 3d engines).

1 Like

I saw the option, but how does that work? It didn’t for me.

1 Like

It only works when it interacts with other objects which have the same physics behavior.

1 Like

We just give our object the “Physis 2” behavior
radius 100, 100, 100…

And it should work with 0 gravity?

1 Like

Not sure what you mean.
Assign Physics2, choose Shape Circle, and choose radius and offset if necessary.
Gravity doesn’t impact object shape.

2 Likes

I mean, I did that

But my object are still going on each others.
I want to make a round collision shape to get soft collision.

1 Like

Do you understand what offset is?
offset = décalage
Load your sprite below (A temporary image…) zoom in to adequate size, and check visually that the hitbox shown in red is correct.

2 Likes

I didn’t. I changed

I tried and it looks exactly what i wanted with the picture on the temporary image in the behavior.
But it still doesn’t works on screen.
Should I activate the behavior or make something like this?

1 Like

Behaviors are activated by default.
Explain clearly what “doesn’t work”, maybe with screenshots.

1 Like

I mean, the hitbox seems to be a circle as I whish
Capturecontact

But the object seems to go on each others without taking in account the hitbox.
Capture3

1 Like

Your hitbox looks okay.
Maybe you have other events conflicting with this? Are you trying to move them with force actions or other behaviors?

I tried adding a similar square with circle hitbox and no gravity in the physics example, and it works fine.

1 Like

yes they are moving with events.

Might it be the problem?

1 Like

You have to use Physics events.

2 Likes