viblo / pymunk

Pymunk is a easy-to-use pythonic 2d physics library that can be used whenever you need 2d rigid body physics from Python
http://www.pymunk.org
MIT License
929 stars 189 forks source link

Spatial Hash Support #179

Closed LennyPhoenix closed 4 years ago

LennyPhoenix commented 4 years ago

I was reading up on how to apply spatial hashing when I discovered that Chipmunk itself actually has an option for spatial hashing instead of the standard axis-aligned bounding box tree.

Source: https://chipmunk-physics.net/release/ChipmunkLatest-Docs/#cpSpace-SpatialHash

Could we get an option to enable this?

viblo commented 4 years ago

Hi! Definately, just added it to master. So far quite untested, so would be great if you could try it.

viblo commented 4 years ago

Realized I should probably give an example use case also:

dim = 10
count = 1000
space.use_spatial_hash(dim, count)
LennyPhoenix commented 4 years ago

Thank you for the quick response and implementation!

LennyPhoenix commented 4 years ago

Ill try it out @viblo. Do I need to clone this repo directly or have you already released it to pypi?

viblo commented 4 years ago

Clone the repo is quickest. I can make a release later, maybe with a week or so.

On Sat, May 16, 2020, 22:55 DoAltPlusF4 notifications@github.com wrote:

Ill try it out @viblo https://github.com/viblo. Do I need to clone this repo directly or have you already released it to pypi?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/viblo/pymunk/issues/179#issuecomment-629704560, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJD2CCOAVGYH2BNNWY6U53RR34SRANCNFSM4NC4F3VQ .