Hello,
I always try to keep the used libs at a minimum. I know we are talking here about ~160kb but anyways.
Currently creating a mesh based collisionshape needs the terrain library, but a simple change in the order of checking the types would eliminate this dependency.
Here is the patch:
[patch]
This patch file was generated by NetBeans IDE
It uses platform neutral UTF-8 encoding and n newlines.
— Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -161,17 +161,17 @@
-
@return A MeshCollisionShape or a CompoundCollisionShape with MeshCollisionShapes as children if the supplied spatial is a Node. A HeightieldCollisionShape if a TerrainQuad was supplied.
*/
public static CollisionShape createMeshShape(Spatial spatial) {
-
if (spatial instanceof TerrainQuad) {<br />
-
if (spatial instanceof Geometry) {<br />
-
return createSingleMeshShape((Geometry) spatial, spatial);<br />
-
} else if (spatial instanceof Node) {<br />
-
return createMeshCompoundShape((Node) spatial);<br />
-
}else if (spatial instanceof TerrainQuad) {<br />
TerrainQuad terrain = (TerrainQuad) spatial;
return new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale());
} else if (spatial instanceof TerrainPatch) {
TerrainPatch terrain = (TerrainPatch) spatial;
return new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale());
-
} else if (spatial instanceof Geometry) {<br />
-
return createSingleMeshShape((Geometry) spatial, spatial);<br />
-
} else if (spatial instanceof Node) {<br />
-
return createMeshCompoundShape((Node) spatial);<br />
-
} else {<br />
-
} else {<br />
throw new IllegalArgumentException("Supplied spatial must either be Node or Geometry!");
}
}
[/patch]