From 19403e56603ee0c1cc44a4e043141d5e2f24568a Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Wed, 22 Jun 2011 12:07:04 +0000 Subject: [PATCH] - add fix for physics mesh generation and physics collision shape ignore flag to native bullet git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7687 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../bullet/com/jme3/bullet/util/CollisionShapeFactory.java | 7 ++++++- engine/src/bullet/com/jme3/bullet/util/NativeMeshUtil.java | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/engine/src/bullet/com/jme3/bullet/util/CollisionShapeFactory.java b/engine/src/bullet/com/jme3/bullet/util/CollisionShapeFactory.java index 012d8a9d5..d2a15de84 100644 --- a/engine/src/bullet/com/jme3/bullet/util/CollisionShapeFactory.java +++ b/engine/src/bullet/com/jme3/bullet/util/CollisionShapeFactory.java @@ -46,6 +46,7 @@ import com.jme3.scene.Geometry; import com.jme3.scene.Mesh; import com.jme3.scene.Node; import com.jme3.scene.Spatial; +import com.jme3.scene.UserData; import com.jme3.terrain.geomipmap.TerrainPatch; import com.jme3.terrain.geomipmap.TerrainQuad; import java.util.Iterator; @@ -91,6 +92,10 @@ public class CollisionShapeFactory { if (spatial instanceof Node) { createCompoundShape(realRootNode, (Node) spatial, shape, meshAccurate, dynamic); } else if (spatial instanceof Geometry) { + Boolean bool = spatial.getUserData(UserData.JME_PHYSICSIGNORE); + if (bool != null && bool.booleanValue()) { + continue; // go to the next child in the loop + } if (meshAccurate) { CollisionShape childShape = dynamic ? createSingleDynamicMeshShape((Geometry) spatial, realRootNode) @@ -229,7 +234,7 @@ public class CollisionShapeFactory { return null; } } - + /** * This method moves each child shape of a compound shape by the given vector * @param vector diff --git a/engine/src/bullet/com/jme3/bullet/util/NativeMeshUtil.java b/engine/src/bullet/com/jme3/bullet/util/NativeMeshUtil.java index d1950ffc6..83656d30a 100644 --- a/engine/src/bullet/com/jme3/bullet/util/NativeMeshUtil.java +++ b/engine/src/bullet/com/jme3/bullet/util/NativeMeshUtil.java @@ -52,7 +52,7 @@ public class NativeMeshUtil { int numTriangles = mesh.getTriangleCount(); int triangleIndexStride = 12; //3 index entries * 4 bytes each. - IndexBuffer indices = mesh.getIndexBuffer(); + IndexBuffer indices = mesh.getIndicesAsList(); FloatBuffer vertices = mesh.getFloatBuffer(Type.Position); vertices.rewind();