john-blackburn / box2d-lite-c

Conversion of box2d-lite into C for eventual compile into Z80 ASM
4 stars 0 forks source link

Raycasts and Sensors #1

Open Timofffee opened 2 years ago

Timofffee commented 2 years ago

When there is a definition of collisions, this is fine, but there are very few raycasts and sensors. Do you have any ideas how to make them the easiest?

I know that they are not in the original Box2D Lite, but I would really like to see them in this implementation, since their presence would make this implementation as suitable as possible for simple games.

john-blackburn commented 1 year ago

Sorry to take so long to get back to you. My motivation for converting this is to make a simple physics engine for the ZX Spectrum (and maybe Amstrad CPC later) so I need to make it as simple as possible (only one fixture, no joints etc). I'm now in the process of converting to Z80 ASM, I tried z88dk without success (it is not standards compliant disappointingly) so am now hand converting to asm. I think if you want more features you'd be better going back to the original Box2d-lite repo, adding stuff there would benefit more people anyway.

In terms of how to detect if a collision is occurring, I think you could just investigate the Arbiter list directly (g_arbiters). Each Arbiter in the list represents an ongoing collision between the specified bodies.

Timofffee commented 1 year ago

my idea was to use physics on the Playdate game console. it is also very limited in performance.