williamngan / pts

A library for visualization and creative-coding
https://ptsjs.org
Apache License 2.0
5.19k stars 182 forks source link

detecting collission in a 2d world #154

Closed jamesb93 closed 2 years ago

jamesb93 commented 3 years ago

Hi there,

Are there are any "batteries included" methods for detecting collisions between Particles in a World? I'd like to make a cute music app where people bash around which when collide trigger sounds. I'm guessing I'd need to write something relatively hefty inside the animate() loop if not but I was curious if I had missed a good example somewhere of this being performed already.

williamngan commented 3 years ago

Hi @jamesb93 - You can take a look at this demo and see if it helps with your use case: https://ptsjs.org/demo/?name=physics.particles

The physics engine in Pts is still very rough. You can also consider using other physics engines with Pts together.

williamngan commented 2 years ago

Hope this helps with your question. Closing this issue now.