Terrain Collision tutorial crashes (fixed)

I’m trying to follow this tutorial but when I compile and run it, it crashes.



https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:intermediate:terrain_collision



WARNING: Uniform m_VertexColor is not declared in shader.
warning CollisionDispatcher.needsCollision: static-static collision!
Dec 11, 2010 11:00:49 AM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.ClassCastException: com.bulletphysics.dom.HeightfieldTerrainShape cannot be cast to com.bulletphysics.collision.shapes.BvhTriangleMeshShape


If I remove the Physics stuff for the terrain it runs fine, so I imagine it has to do with the 'HeightfieldCollisionShape'. I realize the tutorial says *Work in progress*, is that why this doesn't work? Does this crash for everyone or just me?

You updated to the latest nightly I guess? Then the CollisionShapeFactory produces a HeightMapCollisionShape instead of a MeshCollisionShape when you use the createMeshShape() method. Its way more computation efficient.

All right, turns out I didn’t have the latest update. Thought I had it but I didn’t. After updating, it works. Thanks.