How Bounding Shapes works in FXGL? #1436
LifeDrainingCoding
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Here's an example: This screenshot shows Bounding Shapes of the entities with blue lines (Enabled via developer menu). You see that bounding shape doesn't match view?
.
I assume that happens b'cuz
Circleview starting constructing from the center point andBoundingShape.circlestarting point is top-left. I wonder WHY circle bounding shape constructs from the top-left of the starting point and viewCircle(that one extendsNode) where starting point is the center of the view citcle?Alright, that's not the main case and can be easily fixed but that is annoying. The main case is why
BoundingShape.circle()isn't responsible for collision? Why View component serve that role? And bounding shapes just phases freely through other bounding shapes even with collidable components that's has boolean property is true.On the screenshot below you can clearly see that bounding shape completly phases freely through other bounding shape and only the center of circle view that is red preventing them from escaping to out of bounds.

To prove that i'm not yapping for no reason here's my entity with circle bounding shape and circle view , and you can easily test that on your own.
Alright after fixing that local origin of bounding box (just substract it by radius):

HitBox hitBox = new HitBox(new Point2D(-radius, -radius),BoundingShape.circle( radius));and we have bounding circle that mathces the view circle. And the most funny thing is that this fixed issue with bounding shapes that 'phases' through other bounding shape(Actually not). I suppose that is debug renderer issue , so when entity spins it shows that bounding shape that's anchored on the top left origin is also spinning BUT actually it doesn't spins at all as it shows by enabling that option on the screenshot:That's was fun way to define why debug renderer is partially lying to me.
All reactions