Physics lib

BlitzMax Forums/BlitzMax Programming/Physics lib

boomboommax(Posted 2005) [#1]
lo, ive started working on a phys lib for max (free) er its setup to be used for 3d or 2d, its using a standard verlet method, and heres a lil lil test exe just to check for any probs early on!

http://legion.gibbering.net/cyanidenights/files/maxphys.rar

just a simple er shape really, move with the mouse, should work fine... nehow (gets back to code)

edit: sample updated, crate on a stretchy rope:)


Filax(Posted 2005) [#2]
Very nice ! :) but easy to use ?


boomboommax(Posted 2005) [#3]
very easy to use, its all object based. heres the setup code for the first sample i posted (not the current one)

Local Physics_Obj:Photon_Physics_Lib = New Photon_Physics_Lib

Local tmpparticle:Photon_Physics_Particle[7]
tmpparticle[0] = Physics_Obj.AddParticle([200.0,100.0,0.0])
tmpparticle[1] = Physics_Obj.AddParticle([250.0,100.0,0.0])
tmpparticle[2] = Physics_Obj.AddParticle([250.0,150.0,0.0])
tmpparticle[3] = Physics_Obj.AddParticle([200.0,150.0,0.0])
tmpparticle[4] = Physics_Obj.AddParticle([200.0,200.0,0.0])
tmpparticle[5] = Physics_Obj.AddParticle([200.0,250.0,0.0])
tmpparticle[6] = Physics_Obj.AddParticle([200.0,300.0,0.0])

Physics_Obj.AddConstraint([tmpparticle[0],tmpparticle[1]])
Physics_Obj.AddConstraint([tmpparticle[1],tmpparticle[2]])
Physics_Obj.AddConstraint([tmpparticle[2],tmpparticle[3]])
Physics_Obj.AddConstraint([tmpparticle[3],tmpparticle[0]])

Physics_Obj.AddConstraint([tmpparticle[0],tmpparticle[2]])
Physics_Obj.AddConstraint([tmpparticle[1],tmpparticle[3]])

Physics_Obj.AddConstraint([tmpparticle[3],tmpparticle[4]])
Physics_Obj.AddConstraint([tmpparticle[4],tmpparticle[5]])
Physics_Obj.AddConstraint([tmpparticle[5],tmpparticle[6]])


then just call Physics_Obj.Update() in the main loop
edit: there is also now another option in the AddConstraint that enables you to make softbodies and all kinda squishy maddness.


Genexi2(Posted 2005) [#4]
Very slick demo there, how fast is it btw? No computing time in millisecs shown onscreen in the provided demo.


DocFritz(Posted 2005) [#5]
Nice Demo, but I think there is something missing, like... friction. If you let the cube-thingy fall on the ground, it won't stop slipping around.

Will you Lib include pixelperfect Collision-response? That would be great =)


Filax(Posted 2005) [#6]
I can't wait !! :)


nawi(Posted 2005) [#7]
I like it.


SillyPutty(Posted 2005) [#8]
awsome, cant wait for this !


boomboommax(Posted 2005) [#9]
@DocFritz - friction is now in too:) will upload a nicer demo tonight at some point (got the gfs relatives around tonight n tomorrow so might be sometime tomorrow evening at latest)


BlitzSupport(Posted 2005) [#10]
Whoa, this looks nice.


Tibit(Posted 2005) [#11]
Impressive!


Paul "Taiphoz"(Posted 2005) [#12]
i like a lot.

wish the forums had a feature to track threads . :/

Oh well gues I will have to drag a shortcut to this thread to my desktop..


boomboommax(Posted 2005) [#13]
lo, quick update exe with collin aka the Mr Ragdoll man, this is a sample of using the system in 3d (the demo is draw in 2d thou) but it shows collin spinning around and cool stuff:)

windows version:
http://legion.gibbering.net/cyanidenights/files/maxphysrag.rar

linux version:
http://legion.gibbering.net/cyanidenights/files/maxphysrag.zip

leftmouse button toggles snap


Sweenie(Posted 2005) [#14]
@{cYanide}
Are you good at algorithms?
I've read the new paper on softbodies from one of the Novodex guys and the concept seems easy, the problem is I don't have a clue on how to translate the algorithms into ordinary code.
Check it out, it's awesome.
http://www.matthiasmueller.info/
The paper is called 'Meshless Deformations Based on Shape Matching'


skn3(Posted 2005) [#15]
Awsome, something like this will come in handy ;)
keep it up dude :D


boomboommax(Posted 2005) [#16]
@ Sweenie: you can already do some softbody things (eg the things in bouncers nano demo... that kinda stuff), but i will have a read of the paper thou


boomboommax(Posted 2005) [#17]
hey er i made a lil forum im gonna be posting more samples and diff versions of the module as i progress. link is in my sig

(better then me spamming the forums here)

it also doubles for a general programming forum, so feel free to use

edit: the whole db sys on the server i use seems to have just died, er so it should be back soon i hope


Sweenie(Posted 2005) [#18]

you can already do some softbody things (eg the things in bouncers nano demo... that kinda stuff)

Yes, i'm aware of that. I have fiddled with the verlet method before.
What's so amazing with the new method is that it doesn't depend on the user to set up distance constraints.
It simply takes any pointcloud and strive to keep that shape at all times. By adjusting an alpha value you can control how fast it returns to that original shape.
An alphavalue of 0.1 makes the object very squishy and bendy while an Alphavalue of 1.0 makes the shape almost completely rigid.
And this method is very very stable as well.
According to the author it can handle extreme stress without exploding.

The basic method is as following(if I understood the paper correctly).

You have 2 lists of points(particles).
One list keeps the original position of the particles and the other list keeps the moving particles.

After one iteration you use the shapematching algorithm to position and orient the original shape based on the positions of the moved particles.
After the shapematching step, you translate the moving particles towards the points in the transformed original shape, using the alphavalue to control if the points should move to their goalpoints in one step or not.

Sorry if I hijacked your thread. :/


boomboommax(Posted 2005) [#19]
no worries, :D


Booticus(Posted 2005) [#20]
This is looking hot! Cant wait to fiddle around with it. The Mr Ragdoll Man makes me think of three words: Alien Abduction Game. Thatd be hot to swoop a guy up into a UFO with those physics. :) Arms all flailin'.....legs all twisted....gettin the probe....oops did I type that out loud?


Filax(Posted 2005) [#21]
Any new from this ?


boomboommax(Posted 2005) [#22]
im making some examples and docs at the moment:)


SillyPutty(Posted 2005) [#23]
looking forward :)


Filax(Posted 2005) [#24]
Coolz !


Leiden(Posted 2005) [#25]
Wow this is the shiz, any chance your gonna work on a 3D physics library after this? :D


boomboommax(Posted 2005) [#26]
actually it should work in 3d already, erm will do a demo in 3d soon, (its currently in pre-release testing/fixing/etc mode with a few peeps)


Qweeg(Posted 2005) [#27]
This sounds great! At the risk of getting told off for posting the same idea in multiple threads, would it be possible to use this to handle the ball physics of a pool/snooker game? In particular the effect of applying Back/Top/Side spin to the cue ball?


AntonyWells(Posted 2005) [#28]
Nice.

(Jfk)When uh, are uh, you releasing it uh, to the uh publich. uh. uh.

Uh did you guys see a lens flash? Edit- No wait, that's columbo....


Filax(Posted 2005) [#29]
Any news about this lib ? :)


Algo(Posted 2005) [#30]
I tried several times to register on your forums cyan but couldn't.

Any more news on this?


Filax(Posted 2005) [#31]
Seem no :)


TartanTangerine (was Indiepath)(Posted 2005) [#32]
I've got the lib and it works great.


Filax(Posted 2005) [#33]
Only download from the Cyanide forum ?


Booticus(Posted 2005) [#34]
Yeah I cant register either! Cyanide! Help us out eh? ;)


Haramanai(Posted 2005) [#35]
I cant register too.


SillyPutty(Posted 2005) [#36]
well it is only for testers atm.


Haramanai(Posted 2005) [#37]
And of course we cannot be testers!


Neuro(Posted 2005) [#38]
Heh...he wrote it, he can decide who tests and who doesn't.