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
Copy file name to clipboardExpand all lines: CHANGELOG.rst
+86-42Lines changed: 86 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,53 +4,97 @@ Changelog
4
4
Pymunk 7.0.0 (2025-04-10)
5
5
-------------------------
6
6
7
-
TODO: Add note of new collision handler logic!
8
-
9
-
**Many improvements, with some breaking changes!**
10
-
11
-
This is a big cleanup release with several breaking changes. If you upgrade from an older version, make sure to pay attention, especially the Space.bodies, Space.shapes and shape.constraints updates can break silently!
12
-
13
-
Extra thanks for Github user aatle for a number of suggestions and feedback for this Pymunk release!
14
-
15
-
16
-
Changes:
17
-
18
-
Breaking changes
19
-
20
-
- Unified all Space.query methods to include sensor shapes. Previsouly the nearest methods filtered them out.
21
-
- Changed Space.shapes, Space.bodies and Space.constraints to return a KeysView of instead of a list of the items. Note that this means the returned collection is no longer a copy. To get the old behavior, you can convert to list manually, like list(space.shapes).
22
-
- At least one of the two bodies attached to constraint/joint must be dynamic.
23
-
- Vec2d now supports bool to test if zero. (bool(Vec2d(2,3) == True) Note this is a breaking change.
24
-
- Added Vec2d.length_squared, and deprecated Vec2d.get_length_sqrd()
25
-
- Added Vec2d.get_distance_squared(), and deprecated Vec2d.get_dist_sqrd()
26
-
- A dynamic body must have non-zero mass when calling Space.step (either from Body.mass, or by setting mass or density on a Shape attached to the Body). Its not valid to set mass to 0 on a dynamic body attached to a space.
27
-
- Deprecated matplotlib_util. If you think this is a useful module, and you use it, please create an issue on the Pymunk issue track
7
+
**Many improvements and breaking changes!**
8
+
9
+
This is a big cleanup release with several breaking changes. If you upgrade
10
+
from an older version, make sure to pay attention, especially the
11
+
``Space.bodies``, ``Space.shapes`` and ``Space.constraints`` updates can break silently!
12
+
13
+
Extra thanks for Github user aatle for a number of suggestions and feedback
14
+
for this Pymunk release!
15
+
16
+
17
+
The biggest changes relates to collision handlers:
18
+
19
+
- The ``begin``, ``pre_step`` and ``separate`` methods will now always be
20
+
called. ``post_solve`` will continue to only be called if the collision were
21
+
actually processed.
22
+
- You no longer return a ``bool`` from ``begin`` or ``pre_step`` to control if the
23
+
collision should be processed. Instead, there is a property on the ``Arbiter``,
24
+
``process_collision``, that can be set to ``False``.
25
+
- The ``process_collision`` property is stable but updatable, e.g if set to
26
+
``False`` in a ``begin`` callback it will be ``False`` in the ``pre_step``,
27
+
which in turn can toggle it back to ``True``.
28
+
- The ``CollisionHandler`` class itself is no longer public. The ``Space`` has
29
+
a new ``on_collision()`` method that takes the callbacks as arguments without
30
+
returning anything.
31
+
32
+
In addition to the above (which will be easy to spot), there is also a more
33
+
subtle change:
34
+
35
+
- ``Space.shapes``, ``Space.bodies`` and ``Space.constraints`` now return a
36
+
``KeysView``. That means that the returned collection is no longer a copy,
37
+
instead if you hold a ref to it and if you for example add an object to the
38
+
``Space`` it will update. To get the old behavior, you can convert to a list
39
+
manually, e.g ``list(Space.shapes)``.
40
+
41
+
Additional breaking changes:
42
+
43
+
- Unified all ``Space.query`` methods to include sensor shapes. Previously
44
+
the nearest methods filtered them out.
45
+
- At least one of the two bodies attached to a constraint/joint must be
46
+
dynamic.
47
+
- ``Vec2d`` now supports ``bool`` to test if zero. (
48
+
``bool(Vec2d(2,3) == True``).
49
+
- Added ``Vec2d.length_squared``, and deprecated ``Vec2d.get_length_sqrd()``
50
+
- Added ``Vec2d.get_distance_squared()``, and deprecated
51
+
``Vec2d.get_dist_sqrd()``
52
+
- A dynamic body must have non-zero mass when calling ``Space.step()`` (either
53
+
from ``Body.mass``, or by setting ``mass`` or ``density`` on a Shape
54
+
attached to the ``Body``). It is not valid to set ``mass`` to ``0`` on a
55
+
dynamic body attached to a ``Space``.
56
+
- Deprecated ``matplotlib_util``. If you think this is a useful module, and
57
+
you use it, please create an issue on the Pymunk issue tracker at
58
+
https://github.com/viblo/pymunk/issues
28
59
- Dropped support for Python 3.8
29
-
- Changed body.constraints to return a KeysView of the Constraints attached to the body. Note that its still weak references to the Constraints.
30
-
- Reversed the dependency between bodies and shapes. Now the Body owns the connection, and the Shape only keeps a weak ref to the Body. That means that if you remove a Body, then any shapes not referenced anywhere else will also be removed.
31
-
- Changed body.shapes to return a KeysView instead of a set of the shapes.
32
-
- Changed Shape.segment_query to return None in case the query did not hit the shape.
33
-
- Changed ContactPointSet.points to be a tuple and not list to make it clear its length is fixed.
34
-
- Added default do_nothing and always_collide callback functions to the CollisionHandler, so that its clear how to reset and align with other callbacks.
35
-
36
-
New non-breaking features
37
-
- Switched from using Chipmunk to the new Munk2D fork of Chipmunk (see https://github.com/viblo/Munk2D for details).
38
-
- Added Arbiter.bodies shorthand to get the shapes' bodies in the Arbiter
39
-
- New method ShapeFilter.rejects_collision() that checks if the filter would reject a collision with another filter.
40
-
- New method Vec2d.polar_tuple that return the vector as polar coordinates
60
+
- Changed ``Body.constraints`` to return a ``KeysView`` of the Constraints
61
+
attached to the ``Body``. Note that its still weak references to the
62
+
Constraints.
63
+
- Reversed the dependency between bodies and shapes. Now the ``Body`` owns the
64
+
connection, and the ``Shape`` only keeps a weak ref to the ``Body``. That
65
+
means that if you remove a ``Body``, then any shapes not referenced
66
+
anywhere else will also be removed.
67
+
- Changed ``Body.shapes`` to return a ``KeysView`` instead of a set of the shapes.
68
+
- Changed ``Shape.segment_query`` to return None in case the query did not
69
+
hit the shape.
70
+
- Changed ``ContactPointSet.points`` to be a ``tuple`` and not ``list`` to
71
+
make it clear its length is fixed.
72
+
- Added default ``empty_callback``, that can be used to efficiently reset
73
+
any callback to default.
74
+
75
+
New non-breaking features:
76
+
77
+
- Switched from using Chipmunk to the new Munk2D fork of Chipmunk (see
78
+
https://github.com/viblo/Munk2D for details).
79
+
- Added ``Arbiter.bodies`` shorthand to get the shapes' bodies in the ``Arbiter``.
80
+
- New method ``ShapeFilter.rejects_collision()`` that checks if the filter
81
+
would reject a collision with another filter.
82
+
- New method ``Vec2d.polar_tuple`` that return the vector as polar coordinates
83
+
- Changed type of ``PointQueryInfo.shape``, ``SegmentQueryInfo.shape`` and
84
+
``ShapeQueryInfo.shape`` to not be ``Optional``, they will always have a shape.
41
85
- Build and publish wheels for Linux ARM and Pypy 3.11
42
-
- Changed type of PointQueryInfo.shape, SegmentQueryInfo.shape and ShapeQueryInfo.shape to not be Optional, they will always have a shape.
43
-
44
-
Other improvements
45
-
- Optimized Vec2d.angle and Vec2d.angle_degrees. Note that the optimized versions treat 0 length vectors with x and/or y equal to -0 slightly differently.
46
-
- Fixed issue with accessing Body.space after space is deleted and GCed.
47
-
- Improved documentation in many places (Vec2d, Poly, Shape and more)
48
-
- Internal cleanup of code
49
-
50
-
Extra thanks for aatle for a number of suggestions for improvements in this Pymunk release
51
86
52
87
88
+
Other improvements:
53
89
90
+
- Optimized ``Vec2d.angle`` and ``Vec2d.angle_degrees``. Note that the
0 commit comments