Loveballs, A love2d Softbody lib
Posted: Wed Oct 08, 2014 3:43 pm
LOVEBALLS
Loveballs is a small softbody lib I have been working on for personal projects.
It's pretty easy to use, here is a small example
Documentation
Credit to Amadiro/Jonathan Ringstad for the tesselate function
Credit to me(Shorefire/Indieretro) and Jonathan Ringstad not required, but appreciated. Feel free to use the lib/code however you want, just as long as you dont claim it as your own.
To do list
-Allow the creation of arbitrary shapes
-Manually set the amount of nodes
-Manually set the size of nodes
Licence: http://opensource.org/licenses/Zlib
Github: https://github.com/siObyte/loveballs
----Update log
+Added tesselate count
+Added destroy function
+Added line width arg to draw
*Major change to node joints (Want to roll the softbody? apply a AngularImpulse to object.sourceBody!)
--Update 15/1/15
*Important change to softbody physics
*Cleaned up a little bit of code
*Renamed loveballs.lua to init.lua, just require the folder now
--Update 1/2/15
+Added getPoints()
+Added setFriction(f)
+Added update()
+Added comments
*Moved tess to update
*Cleaned up code
*Renamed sourceBody to centerBody (for shape & fixture to)
--Update 24/2/15
+New example in the github repo
*Moved source to github
*Fixed a few bugs
*Changed how the lib is required
--Update 27/2/15
+Indexing a softbody will return the node (see readme in repo)
*Removed yaci class lib depend
*Changed over to metatables
*Changed construction syntax a little
Loveballs is a small softbody lib I have been working on for personal projects.
It's pretty easy to use, here is a small example
Documentation
Code: Select all
--Creates a softbody
--smoothing is optional, the default settings are the best, essentially the number is how many nodes to pass in
--tessellate count, the higher the better quality, but anything too large will probably cause performance issues
--setting tessellate count to < 1 or a float/double will result in errors
--if you want some neat effects, try a somewhat high smoothing (6-8), with a tessellate count of 1-2
object = Softbody:new(world, x, y, radius, smoothing, tessellatecount)
--Sets the frequency of the softbody
objecy:setFrequency(f)
--Sets the damping ratio of the body
object:setDamping(d)
--Set friction of outer nodes
object:setFriction(f)
--Updates tesselation, required
object:update()
--Draws the softbody
object:draw()
--Draws only a line, instead of a full polygon
object:draw("line")
--Destroys the softbody
object:destroy()
Credit to me(Shorefire/Indieretro) and Jonathan Ringstad not required, but appreciated. Feel free to use the lib/code however you want, just as long as you dont claim it as your own.
To do list
-Allow the creation of arbitrary shapes
-Manually set the amount of nodes
-Manually set the size of nodes
Licence: http://opensource.org/licenses/Zlib
Github: https://github.com/siObyte/loveballs
----Update log
+Added tesselate count
+Added destroy function
+Added line width arg to draw
*Major change to node joints (Want to roll the softbody? apply a AngularImpulse to object.sourceBody!)
--Update 15/1/15
*Important change to softbody physics
*Cleaned up a little bit of code
*Renamed loveballs.lua to init.lua, just require the folder now
--Update 1/2/15
+Added getPoints()
+Added setFriction(f)
+Added update()
+Added comments
*Moved tess to update
*Cleaned up code
*Renamed sourceBody to centerBody (for shape & fixture to)
--Update 24/2/15
+New example in the github repo
*Moved source to github
*Fixed a few bugs
*Changed how the lib is required
--Update 27/2/15
+Indexing a softbody will return the node (see readme in repo)
*Removed yaci class lib depend
*Changed over to metatables
*Changed construction syntax a little