Hey yall,
Got something special to show you :). Its physics!
Me and Per have been working very hard on integrating ODE and jME together to produce a stable system whereby you dont need to use ODE specific things to integrate it. Its very simple to use if I say so myself.
Currently, only masses and their physics are taken account for, but joints are planned.
Heres a screeny for you all:
And here are the webstartable demos for the physics system.
http://www.myjavaserver.com/~digiwired/physics-terrain.jnlp – Terrain
http://www.myjavaserver.com/~digiwired/physics-tower.jnlp – Tower
L8rs, DP
Have you had any problems with TriMesh<->TriMesh collisions (moving objects)
In fact, yes we have. But we overcame this problem in two fold:
1) If the shape is neither a box or a sphere, then we approximate the ODE placable as a box or as a sphere using its boundingVolume.
2) We have whats called a PhysicsObject which has a method called "onContact". This method has two paramters. The PhysicsObject that collided with this physics object, and the "Contact" class from ODE.
Now no. 2 is useful so that you can use jME's triangle accurate collision detection method, and see if it has collided or not, if it hasn't, then cancel the contact using the Contact method (can't remeber what it is on top of my head, sorry). It is also useful if you have this kind of situation:
Tank + Mine. Tank gets killed by mine, tank is physics controlled. So in the onContact method you would check if the PhysicsObject's name is "mine", then call TankManager.die() or something similar...
About the negative z component, we haven't had any problems ourselves. All our tests revolve around (0, 0, 0), so there will be alot of -z components. Stange that we haven't got any problems with that....
Anyways, when i get back home, il upload the zip so everyone can use it :)
DP
DP, when can we expect something publicly available?
DP, when can we expect something publicly available?
now! :D
hehe, il upload a zip which contains the source for the physics system, the tests, and their data. And il include the ode libs as well while im at it.
You will ofcourse need jme and lwjgl...etc
The URL for the zip is:
http://www.myjavaserver.com/~digiwired/physicsSystem.zip
Enjoy!
Very nice work, congrats to you both! Seems like the tower one is missing the cool textures though?
the textures are there, webstart just doesn’t like em!
It runs fine locally! When I jar the exact same thing i run…it goes kaboom! It needs fixing tho…i agree.
EDIT: Fixed, it turns out .PNG is different in webstart than .png… ://
DP
Wow, this is just wonderful! Looks great and seems to be very responsive - I still have a decent framerate. I do like it.
Now, imagine adding volumetric shadows… let’s create Half-Life4J
BTW: there is a small typo in PhysicsTerrainTest for the grayscale png, which is referenced in the wrong directory. And, png and PNG are something different under UNIX - the file system there is case sensitive. So if you place files on such a machine, the names must be exactly the same!
So, when will we see this being hosted at jmephysics.mojomonkeycoding.com?
It would be really great if more ppl joined up and helped, because there’s lots of features that needs to be included/worked on:
- frame rate independance (it kind of works atm, but the thing is that it calls World.setStepSize(float) alot which we’ve been adviced not to).
- ragdoll support (joints would need to be worked on).
- vehicle support (would be nice to have an equivalent to Xith3Ds CarDemo).
- replace vecmath with jME math (if someone feel like putting up all the tidious work).
/Per
BTW: there is a small typo in PhysicsTerrainTest for the grayscale png, which is referenced in the wrong directory. And, png and PNG are something different under UNIX - the file system there is case sensitive. So if you place files on such a machine, the names must be exactly the same!
Yeah sorry, my bad. I fixed all those locally, made the jar for the test, and forgot about the uploading the actual source. Those two are the only changes...
Im going to start joints now...so we can have a steering mechanism for the car and ragdolls...anyone interested in joining me with this?
frame rate independance
Well, we ended up solving it in a different way didn't we per? We ended up saying that we need to use FixedFrameRate instead of a varied frame rate...So technically, if you are willing to restrict your FPS to say around 60ish (or whatever VSync is), then frame rate independance is solved. However, thats a restriction I would rather not impose on the user and im trying my best to find a solution for this.
DP
If it would be feasable to make it truly frame rate independant, that would be awsome.
very cool guys. Lots of fun to see what happens with the spheres on that terrain.
A little interaction would be cool if that’s possible.
A little interaction would be cool if that's possible
You got it mojo. You can now "push" things with your camera. Go on, try it out, its sooo much fun.
I dare you to push one block (in the towers demo) whereby it hits another and the second hits the big metal ball. :D
DP
Now THAT’S fun.
The demos look good. Most physics demos allow you to throw balls, witch you may want to consider for this one. By the way I cant push the big ball in the tower demo.
Very nice… now, can we break those boxes down into scraps with a crowbar? }
Very, very cool. Good job!
By the way I cant push the big ball in the tower demo
Umm...you can! Its just that metal ball weighs 1000 units and the camera weighs around 0.1 units! The only reason you can push other lighter objects is because you are constantly applying a small force x amount of times in a single second (the x would be your frame rate).
Very nice... now, can we break those boxes down into scraps with a crowbar?
Very soon renanse...very soon! Im hoping to get joints into place and extend those to make breakable joints, so you can break em...we'l see. Heh, maybe il use HL2's method and just alter the bump mapping on those :)
DP
Looks very nice… congrats!
The Terrain one failed to run on OS X (I did not try the other):
java.lang.NullPointerException
at jmetest.physics.PhysicsTerrainTest.cleanup(PhysicsTerrainTest.java:318)
at com.jme.app.BaseGame.start(Unknown Source)
at jmetest.physics.PhysicsTerrainTest.main(PhysicsTerrainTest.java:324)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.javaws.Launcher.executeApplication(Launcher.java:848)
at com.sun.javaws.Launcher.executeMainClass(Launcher.java:808)
at com.sun.javaws.Launcher.continueLaunch(Launcher.java:682)
at com.sun.javaws.Launcher.handleApplicationDesc(Launcher.java:397)
at com.sun.javaws.Launcher.handleLaunchFile(Launcher.java:199)
at com.sun.javaws.Launcher.run(Launcher.java:167)
at java.lang.Thread.run(Thread.java:552)
thats because we dont have the natives for OSX in the jnlp ://
Il add them in when we release 0.2
DP
Niiice!