You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like chaning X scale (it doesn't matter whether the change includes sign change such as from +1 to -1, it still apears, for instance, from +1 to +0.5) invokes a shift of PhysicsComponent's onGroundProperty.
The text was updated successfully, but these errors were encountered:
monjasa
changed the title
Fix firing ChangeListener with onGroundProperty() using set
Fix firing ChangeListener on onGroundProperty() with setScaleX()
Mar 25, 2020
Changing the scale of an entity affects its physics shape, which in turn requires the physics world to re-create the fixtures used in collision checks. When previous fixtures are removed, the onGround property becomes false since there is no fixture. Then when a new fixture is created, this triggers the onGround property to become true. So this is not a bug per se.
The above re-creation is necessary since even with just scaleX = -1 asymmetric hitboxes will need to be recalculated.
I don't have a clean solution to this yet, so I'll need some time to think. Any ideas?
For my problem (exclude triggering with mirroring but keep with jumping) I've used a boolean variable . Inside jump() method I've got something like if (!jumping) jumping = true; if the entity isOnGround() (its physics component with a ground sensor), and then add new ChangeListener with overridden method:
I mean, maybe it's possible to add kind of 'lock'. But I guess it's neither thread-safe nor applicable without a loss of performance due to checking and saving such a variable.
It seems like chaning X scale (it doesn't matter whether the change includes sign change such as from +1 to -1, it still apears, for instance, from +1 to +0.5) invokes a shift of PhysicsComponent's onGroundProperty.
The text was updated successfully, but these errors were encountered: