Skip to content

Update pymunk_physics_engine.py#1322

Merged
pvcraven merged 1 commit intopythonarcade:developmentfrom
MostTornBrain:development
Sep 17, 2022
Merged

Update pymunk_physics_engine.py#1322
pvcraven merged 1 commit intopythonarcade:developmentfrom
MostTornBrain:development

Conversation

@MostTornBrain
Copy link
Contributor

Per pymunk documentation, the pre handler is supposed to return a bool:

"Return false from the callback to make pymunk ignore the collision this step or true to process it normally. Additionally, you may override collision values using Arbiter.friction, Arbiter.elasticity or Arbiter.surfaceVelocity to provide custom friction, elasticity, or surface velocity values. See Arbiter for more info."

This addresses the error which occurs if you define a pre_handler function for collisions without this fix.:
"UserWarning: Function '_f3' should return a bool to indicate if the collision should be processed or not when used as 'begin' or 'pre_solve' collision callback.
def _f3(arbiter, space, data):"

Per pymunk documentation, the pre handler is supposed to return a bool
@pushfoo
Copy link
Member

pushfoo commented Sep 17, 2022

This might be worth backporting to 2.6.X if we plan to do another release in that branch

Copy link
Member

@pushfoo pushfoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me & works locally. I can't merge it myself, but einarf or Clepto might get to it later tonight.

@einarf einarf requested a review from pvcraven September 17, 2022 01:02
@einarf
Copy link
Member

einarf commented Sep 17, 2022

@pvcraven can you look at this?

@pvcraven pvcraven merged commit 5a69eac into pythonarcade:development Sep 17, 2022
pvcraven pushed a commit that referenced this pull request Sep 24, 2022
Per pymunk documentation, the pre handler is supposed to return a bool

(cherry picked from commit 5a69eac)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants