JME2 alpha and JMEPhysics

So, just a quick, probably dumb question . . .



Is there a version of JMEPhysics that works with the JME 2.0 alpha?  It's pretty close, but all the constants in the old JME 1.0 are now enums, so a bunch of stuff doesn't compile.  No biggie . . . I can fix most of it myself, and what I can't fix, I can guess at, but I'm just curious if I'm re-doing a bunch of work already done elsewhere?



-Falken

Well I won't complain. I pick up where you left off.

Nymon was planning to do that… but there is no jME 2 compatible version yet.

I'm still planning on doing that. I'll should get enough time to complete it this week, will let you know.

As I just needed jME Physics for jME 2, I started porting - the src folder is done (checked in). Would be great if you could continue on the test and tutorial stuff.

Hello people.



I would also like jmePhysics working on jME2, so I was porting. Fortunately is pretty straightforward.



However, I am stuck with Trimeses. on jME we had the multiple batches. I remember writing a patch to support that so generatePhysicsGeometry worked with multiple batches.



I am getting multiple batches from the Collada importer.



May please someone provide me with some guidance about how to approach this now?


  1. What have batches been replaced with?


  2. How will the Collada importer now import my obejcts with different textures in different faces? Or will they be multiple meshes? Some clarification here or a reference would help!



    Thank you very much guys!

This has already been completed. Please checkout the project from svn in google code, just search for jME physics 2, it will come up.

Oh! **$$!  :x



Now that I had figured out!



It's already working for me too  :D. It was pretty straightforward, too.



I'll download the newer one!



Thank you very much for this quick response! And you (almost) saved me a a couple of hours ;). No, seriously, thanks for your reply.



Regards,

Here’s the link to the Google code.

I kept getting compile errors for tutorial and test-interactive. So I decided to port them over to JME2.0. Here's the patch file:



Index: test-interactive/com/jmetest/physics/TestGenerateTerrain.java
===================================================================
--- test-interactive/com/jmetest/physics/TestGenerateTerrain.java   (revision 195)
+++ test-interactive/com/jmetest/physics/TestGenerateTerrain.java   (working copy)
@@ -186,7 +186,7 @@
         Vector3f terrainScale = new Vector3f( 10, 1, 10 );
         heightMap.setHeightScale( 0.001f );
         TerrainPage page = new TerrainPage( "Terrain", 33, heightMap.getSize(), terrainScale,
-                heightMap.getHeightMap(), false );
+                heightMap.getHeightMap() );
         page.setDetailTexture( 1, 16 );
 
         CullState cs = DisplaySystem.getDisplaySystem().getRenderer().createCullState();
Index: tutorial/com/jmetest/physicstut/Lesson3.java
===================================================================
--- tutorial/com/jmetest/physicstut/Lesson3.java   (revision 195)
+++ tutorial/com/jmetest/physicstut/Lesson3.java   (working copy)
@@ -39,7 +39,7 @@
 import com.jme.renderer.Renderer;
 import com.jme.scene.Spatial;
 import com.jme.scene.shape.Box;
-import com.jme.scene.state.AlphaState;
+import com.jme.scene.state.BlendState;
 import com.jme.scene.state.MaterialState;
 import com.jmex.physics.DynamicPhysicsNode;
 import com.jmex.physics.StaticPhysicsNode;
@@ -132,12 +132,12 @@
         final MaterialState materialState = display.getRenderer().createMaterialState();
         materialState.setDiffuse( color );
         if ( color.a < 1 ) {
-            final AlphaState alphaState = display.getRenderer().createAlphaState();
-            alphaState.setEnabled( true );
-            alphaState.setBlendEnabled( true );
-            alphaState.setSrcFunction( AlphaState.SB_SRC_ALPHA );
-            alphaState.setDstFunction( AlphaState.DB_ONE_MINUS_SRC_ALPHA );
-            spatial.setRenderState( alphaState );
+            final BlendState blendState = display.getRenderer().createBlendState();
+            blendState.setEnabled( true );
+            blendState.setBlendEnabled( true );
+            blendState.setSourceFunction( BlendState.SourceFunction.SourceAlpha );
+            blendState.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
+            spatial.setRenderState( blendState );
             spatial.setRenderQueueMode( Renderer.QUEUE_TRANSPARENT );
         }
         spatial.setRenderState( materialState );
Index: tutorial/com/jmetest/physicstut/Lesson8.java
===================================================================
--- tutorial/com/jmetest/physicstut/Lesson8.java   (revision 195)
+++ tutorial/com/jmetest/physicstut/Lesson8.java   (working copy)
@@ -45,7 +45,7 @@
 import com.jme.scene.Spatial;
 import com.jme.scene.Text;
 import com.jme.scene.shape.Box;
-import com.jme.scene.state.AlphaState;
+import com.jme.scene.state.BlendState;
 import com.jme.scene.state.MaterialState;
 import com.jmex.physics.DynamicPhysicsNode;
 import com.jmex.physics.PhysicsSpace;
@@ -137,7 +137,7 @@
         // finally print a key-binding message
         Text infoText = Text.createDefaultTextLabel( "key info", "[del] and [page down] to move, [home] to jump" );
         infoText.getLocalTranslation().set( 0, 20, 0 );
-        fpsNode.attachChild( infoText );
+        statNode.attachChild( infoText );
     }
 
     private void createFloor() {
@@ -215,12 +215,12 @@
         final MaterialState materialState = display.getRenderer().createMaterialState();
         materialState.setDiffuse( color );
         if ( color.a < 1 ) {
-            final AlphaState alphaState = display.getRenderer().createAlphaState();
-            alphaState.setEnabled( true );
-            alphaState.setBlendEnabled( true );
-            alphaState.setSrcFunction( AlphaState.SB_SRC_ALPHA );
-            alphaState.setDstFunction( AlphaState.DB_ONE_MINUS_SRC_ALPHA );
-            spatial.setRenderState( alphaState );
+           final BlendState blendState = display.getRenderer().createBlendState();
+            blendState.setEnabled( true );
+            blendState.setBlendEnabled( true );
+            blendState.setSourceFunction( BlendState.SourceFunction.SourceAlpha );
+            blendState.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);;
+            spatial.setRenderState( blendState );
             spatial.setRenderQueueMode( Renderer.QUEUE_TRANSPARENT );
         }
         spatial.setRenderState( materialState );



Hopefully it may be of some help
yunspace said:

I kept getting compile errors for tutorial and test-interactive.

uh, sorry for that - it was fixed in my local copy and I forgot to put it into svn.