I would like to prevent the character from walking across the water (for this example, but also across any part of landscape of my choice). Is there an easy way to do it ?
I thought about a Geometry box with a RigidBodyControl and CullHint.Always to make it invisible, but it doesn’t fit exactly with the shape of the shore.
Node ghostNode = new Node(“Ghost node”);
Material material = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
Box box = new Box(40, 10, 40); Geometry boxGeometry = new Geometry("Box", box); boxGeometry.setMaterial(material); boxGeometry.setLocalTranslation(100, 1, 2); boxGeometry.addControl(new RigidBodyControl(new MeshCollisionShape(box), 0)); boxGeometry.setCullHint(CullHint.Always); ghostNode.attachChild(boxGeometry); physics.getPhysicsSpace().add(boxGeometry); rootNode.attachChild(ghostNode);
Any idea guys ?