Hey all, having spent a couple hours tonight trying to make a ‘fixed train’ in Aedifico for the story mode I thought it would be better to make it in to a class. I made a thread quite a while ago which featured this video in it somewhere:
https://m.youtube.com/watch?v=hTCIRk9vcGA
I was hoping for it to be implemented as a joint in Codea but it’s possible to do with Codea itself so here it is:
http://www.youtube.com/watch?v=NWMlyNaABEI
Code: http://pastebin.com/kUqtZBpg
To use the rail joint pass the init function a set of points and bodies, all you have to do then put jointvariable:draw() in the draw function in order to keep the forces updated.
I hope someone finds a use for this, I’m going to be looking in to a pulley joint next and hopefully will be able to make a small library of custom box2D joints for the forum in good time.
Edit: forgot to mention as seen around the 0:40 mark there is a bug with the algorithm when rails overlap, this could be a desired effect in some scenarios though.