MasteR Posted July 28, 2010 Share Posted July 28, 2010 I thought I'd try my hand at making physics based cable (rope), and if I had any success, share it with the community. It's still early days for me with this engine and this was really just a learning exercise, it's by no means perfect, but I did learn a bit in the process, so it’s been worthwhile. Its now up to you more capable individuals to make it even better, perhaps a LUA implementation of the code for the Leadwerks Editor would open up the functionality to a wider range of engine owners. One improvement I can think of would be the creation of a “capsule” model and use that instead of the cylinder implementation. This would also open up texturing capabilities too. Grab the code and with a simple implementation like the one below and you'll be off and flying. #include "CPhysicsCable.h" TVec3 startPos = Vec3(-20,15,0); TVec3 endPos = Vec3(20,15,0); /* Parameters from left to right: cable start position – Vec3 object cable end position – Vec3 object cable thickness – float cable segments (quality) – integer cable free hanging (not attached to the end point) - boolean */ CPhysicsCable* cable = new CPhysicsCable(startPos,endPos,0.5,30,1); If anyone makes any improvements then keep the community up to date. 1 Quote AMD Athlon 64 X2 Dual Core 6000+ (3.0 GHz) 4 GB DDR2 RAM 2 x NVIDIA GeForce 9500 GT 512 MB (SLI 1.0 GB) Windows XP Pro Link to comment Share on other sites More sharing options...
Chris Paulson Posted July 28, 2010 Share Posted July 28, 2010 Thanks... but.... where is the code? Quote Link to comment Share on other sites More sharing options...
MasteR Posted July 28, 2010 Author Share Posted July 28, 2010 Thanks... but.... where is the code? Fixed, cheers. Quote AMD Athlon 64 X2 Dual Core 6000+ (3.0 GHz) 4 GB DDR2 RAM 2 x NVIDIA GeForce 9500 GT 512 MB (SLI 1.0 GB) Windows XP Pro Link to comment Share on other sites More sharing options...
AggrorJorn Posted July 28, 2010 Share Posted July 28, 2010 Awesome stuff dude. It is not working yet but here is a start for a Lua equivelant: LuaCable.rar Quote Link to comment Share on other sites More sharing options...
MasteR Posted July 31, 2010 Author Share Posted July 31, 2010 I've made a number of small but significant improvements, download link has been updated. *EDIT* (1.8.10). Final update: I've brushed back up on my C++ and made a few small changes to the class declaration (see below). I've also added an optional method to dynamically change the length of each cable node when the cable is in motion so you should no longer be able to see the cable nodes separate when extreme forces are applied. This method should be called after UpdateWorld(); see new implementation and download below. As I said this will be the final update to the polygonal based implementation, I’m going to try my hand at a particle based implementation in hopes to simulate the cables created in the source engine, stay tuned. CPhysicsCable cable(startPos,endPos,0.05,40,1); cable.Update(); CPhysicsCable.zip Quote AMD Athlon 64 X2 Dual Core 6000+ (3.0 GHz) 4 GB DDR2 RAM 2 x NVIDIA GeForce 9500 GT 512 MB (SLI 1.0 GB) Windows XP Pro Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.