New Codea Tutorial - Collision Detection

There is a new tutorial on collision detection for Codea at:

It shows a number of simple approaches and culminates in building a simple Asteroids app to demonstrate the built in collision detection functionality provided by Box2D.

This is meant to be an introductory tute so I haven’t gone down to pixel perfect collision techniques.

As usual comments, improvements and alternate approaches are welcomed. How do you do collision detection in Codea?

@Reefwing - when I explored the physics engine, I found the entire Debugdraw code to be totally unnecessary, unless you are doing very advanced stuff. I certainly wrote collision code without any of it, and I think Debugdraw is a real red herring because people think it is necessary for them to write physics code.

@Ignatz - you need something to draw the physics bodies each frame. I agree you don’t need to use PhysicsDebugDraw for this but when I started writing my own I ended up reproducing something similar so in the end decided just to simplify the existing class.

There is still unnecessary code in my simplified version, so you may be correct in that I have ended up with something which isn’t totally generalised or bespoke. What do others think?

@Reefwing - I just loop through the sprites attached to the physics bodies, position them, and draw them. There’s no need for any of the tables and fancy stuff in debugdraw.

If you’re trying to make the tutorial as simple as possible, I suggest clearing out unnecessary code. I speak from personal experience, because spent hours trying to decipher debugdraw before realising I didn’t need it at all. IMHO, the physics demo would be much better without it, because it makes physics look way more difficult than it is.

Here is my tutorial on collision detection

Nice tute @Ignatz - and you are correct it is simpler to draw a sprite than reconstruct graphic primitives.