Skip to content

How to create a hollow collision shape? #1381

Answered by AlmasB
LifeDrainingCoding asked this question in Q&A
Discussion options

You must be logged in to vote

I see, if my understanding is correct, when you use outer = new HitBox("outer",BoundingShape.circle(radius));, you end up with a filled rigid circle, but what you actually want is an annulus (a doughnut like shape with a hole inside). FXGL's rigid body dynamics internally uses box2d, which has edge and chain shapes, which may help you, take a look at their documentation.

In FXGL, you can call BoundingShape.XXXX to get edge / chain shapes, instead of circles. See if it works.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@LifeDrainingCoding
Comment options

@AlmasB
Comment options

Answer selected by LifeDrainingCoding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants