Ghost walls

Hi monkeys,

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.

[java]
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);

[/java]

Any idea guys ?

Thanks !

Have you tried using PlaneCollisionShape(s)?

Thanks for reply! I think the best solution is to create very low poly mesh in 3dsmax and attach them in the terrain editor with CullHint.Always.