Pymunk Documentation Release 6.2.0

Pymunk Documentation Release 6.2.0

pymunk Documentation Release 6.2.0 Victor Blomqvist Aug 29, 2021 CONTENTS 1 Installation 3 2 Example 5 3 Documentation 7 4 The Pymunk Vision 9 5 Contact & Support 11 6 Dependencies / Requirements 13 7 Python 2 Support 15 8 Install from source / Chipmunk Compilation 17 9 Contents 19 9.1 Installation................................................ 19 9.1.1 Install Pymunk......................................... 19 9.1.2 Examples & Documentation.................................. 19 9.1.3 Troubleshooting......................................... 20 9.1.4 Advanced - Android Install................................... 20 9.1.4.1 Kivy.......................................... 20 9.1.4.2 Termux......................................... 20 9.1.5 Advanced - Install........................................ 20 9.1.5.1 Advanced - Running without installation....................... 21 9.1.6 Compile Chipmunk....................................... 21 9.1.7 CFFI Installation........................................ 22 9.2 Overview................................................. 22 9.2.1 Basics.............................................. 22 9.2.2 Model your physics objects................................... 22 9.2.2.1 Object shape...................................... 22 9.2.2.2 Center of gravity.................................... 23 9.2.2.3 Mass, weight and units................................ 24 9.2.2.4 Looks before realism................................. 24 9.2.3 Game loop / moving time forward............................... 24 9.2.4 Object tunneling........................................ 24 9.2.5 Unstable simulation?...................................... 25 9.2.6 Performance........................................... 26 9.2.7 Copy and Load/Save Pymunk objects............................. 26 9.2.8 Additional info......................................... 26 i 9.3 API Reference.............................................. 26 9.3.1 pymunk Package........................................ 26 9.3.1.1 pymunk.autogeometry Module........................... 26 9.3.1.2 pymunk.constraints Module............................ 29 9.3.1.3 pymunk.vec2d Module................................ 45 9.3.1.4 pymunk.matplotlib_util Module......................... 49 9.3.1.5 pymunk.pygame_util Module............................ 53 9.3.1.6 pymunk.pyglet_util Module............................ 58 9.4 Examples................................................. 101 9.4.1 Jupyter Notebooks....................................... 101 9.4.1.1 matplotlib_util_demo.ipynb.............................. 101 9.4.1.2 newtons_cradle.ipynb................................. 102 9.4.2 Standalone Python....................................... 102 9.4.2.1 arrows.py....................................... 104 9.4.2.2 balls_and_lines.py................................... 105 9.4.2.3 basic_test.py...................................... 106 9.4.2.4 bouncing_balls.py................................... 106 9.4.2.5 box2d_pyramid.py................................... 107 9.4.2.6 box2d_vertical_stack.py................................ 108 9.4.2.7 breakout.py...................................... 108 9.4.2.8 camera.py....................................... 109 9.4.2.9 constraints.py..................................... 110 9.4.2.10 contact_and_no_flipy.py................................ 111 9.4.2.11 contact_with_friction.py................................ 112 9.4.2.12 copy_and_pickle.py.................................. 113 9.4.2.13 damped_rotary_spring_pointer.py........................... 114 9.4.2.14 deformable.py..................................... 115 9.4.2.15 flipper.py........................................ 116 9.4.2.16 index_video.py..................................... 117 9.4.2.17 kivy_pymunk_demo.................................. 118 9.4.2.18 newtons_cradle.py................................... 119 9.4.2.19 planet.py........................................ 120 9.4.2.20 platformer.py...................................... 121 9.4.2.21 playground.py..................................... 121 9.4.2.22 point_query.py..................................... 122 9.4.2.23 py2exe_setup__basic_test.py............................. 123 9.4.2.24 py2exe_setup__breakout.py.............................. 124 9.4.2.25 pygame_util_demo.py................................. 124 9.4.2.26 pyglet_util_demo.py.................................. 124 9.4.2.27 shapes_for_draw_demos.py.............................. 125 9.4.2.28 slide_and_pinjoint.py................................. 125 9.4.2.29 spiderweb.py...................................... 126 9.4.2.30 tank.py......................................... 127 9.4.2.31 using_sprites.py.................................... 128 9.4.2.32 using_sprites_pyglet.py................................ 129 9.5 Showcase................................................. 130 9.5.1 Games.............................................. 132 9.5.2 Non-Games........................................... 134 9.5.3 Papers / Science......................................... 135 9.5.3.1 Cite Pymunk...................................... 137 9.6 Tutorials................................................. 137 9.6.1 Slide and Pin Joint Demo Step by Step............................. 138 9.6.1.1 Before we start..................................... 139 9.6.1.2 An empty simulation................................. 139 ii 9.6.1.3 Falling balls...................................... 140 9.6.1.4 A static L....................................... 143 9.6.1.5 Joints (1)........................................ 145 9.6.1.6 Joints (2)........................................ 145 9.6.1.7 Ending......................................... 146 9.6.2 External Tutorials........................................ 148 9.6.2.1 Pymunk Basics.................................... 149 9.6.2.2 Simulating physics in Python............................. 149 9.6.2.3 Breakout game in Python, Pyglet and Pymunk.................... 149 9.6.2.4 Pymunk physics in Pyglet............................... 149 9.7 Benchmarks............................................... 149 9.7.1 Micro benchmarks....................................... 149 9.7.1.1 Results:........................................ 150 9.7.2 Compared to Other Physics Libraries.............................. 151 9.7.2.1 Cymunk........................................ 151 9.8 Advanced................................................. 152 9.8.1 Impulse Solver Algorithm................................... 152 9.8.2 Collision Detection Algorithm................................. 153 9.8.3 Why CFFI?........................................... 153 9.8.4 Why ctypes? (OBSOLETE).................................. 153 9.8.5 Code Layout........................................... 154 9.8.6 Tests............................................... 155 9.8.7 Working with non-wrapped parts of Chipmunk........................ 155 9.8.8 Weak References and free Methods............................... 155 9.9 Changelog................................................ 156 9.9.1 Pymunk 6.2.0 (2021-08-25).................................. 156 9.9.2 Pymunk 6.1.0 (2021-08-11).................................. 156 9.9.3 Pymunk 6.0.0 (2020-12-07).................................. 156 9.9.4 Pymunk 5.7.0 (2020-09-16).................................. 159 9.9.5 Pymunk 5.6.0 (2019-11-02).................................. 160 9.9.6 Pymunk 5.5.0 (2019-05-03).................................. 160 9.9.7 Pymunk 5.4.2 (2019-01-07).................................. 161 9.9.8 Pymunk 5.4.1 (2018-12-31).................................. 161 9.9.9 Pymunk 5.4.0 (2018-10-24).................................. 161 9.9.10 Pymunk 5.3.2 (2017-09-16).................................. 162 9.9.11 Pymunk 5.3.1 (2017-07-15).................................. 162 9.9.12 Pymunk 5.3.0 (2017-06-11).................................. 162 9.9.13 Pymunk 5.2.0 (2017-03-25).................................. 163 9.9.14 Pymunk 5.1.0 (2016-10-17).................................. 163 9.9.15 Pymunk 5.0.0 (2016-07-17).................................. 163 9.9.16 Pymunk 4.0.0 (2013-08-25).................................. 164 9.9.17 Pymunk 3.0.0 (2012-09-02).................................. 165 9.9.18 Pymunk 2.1.0 (2011-12-03).................................. 165 9.9.19 Pymunk 2.0.0 (2011-09-04).................................. 166 9.9.20 Pymunk 1.0.0 (2010-07-16).................................. 166 9.9.21 Pymunk 0.8.3 (2009-07-26).................................. 166 9.9.22 Pymunk 0.8.2 (2009-04-22).................................. 166 9.9.23 Pymunk 0.8.1 (2008-11-02).................................. 166 9.9.24 Pymunk 0.8 (2008-06-15)................................... 166 9.9.25 Pymunk 0.1 (2007-08-01)................................... 167 9.10 License.................................................. 167 10 Indices and tables 169 iii Python Module Index 171 Index 173 iv pymunk Documentation, Release 6.2.0 Pymunk is a easy-to-use pythonic 2d physics library that can be used whenever you need 2d rigid body physics from Python. Perfect when you need 2d physics in your game, demo or other application! It is built on top of the very capable 2d physics library Chipmunk. The first version was released in 2007 and Pymunk is still actively developed and maintained today, more than 10years of active development! Pymunk has been used with success in many projects, big and small. For example: 3 Pyweek game competition winners, more than a dozen published scientific papers and

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    187 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us