[SOLVED] How to add the terrain hills to physics

I have created a new scene **

WITH DIFFERENT NAME(THIS IS IMPORTANT,& I DONOT KNOW WHY)

**, imported my Hover Tank into it & created a new Terrain with any property(total size & patch size) in JMonkeyBuilder & added some heights using terrain editor pointer & added to the physics as any normal spatial & it works ,

& finally it works successfully ,

SO THE PROBLEM WASNOT WITH THE CODE AS THERE’s NO CODE , ITS WITH EDITOR , SOMETHING WRONG I HAVE MADE WHEN THE SCENE WAS WITH FILENAME Mars.j3o & there HAS BEEN A CACHE FILE FOR THIS Mars.j3o which is not overwritten by default when i create a new scene with the same name , so the editor has bugs with overriding cache files by default
the selected folder here seems to be holding cache files or database for workspace settings

the code is simply any spatial~physics code can handle this , my code:

 public void addRigidShape(String nodeName, float mass, Vector3f gravity) {
        Spatial spatial = rootNode.getChild(nodeName);
        RigidBodyControl rigidBodyControl = new RigidBodyControl(CollisionShapeFactory.createBoxShape(spatial),mass);
        spatial.addControl(rigidBodyControl);
        physics.getPhysicsSpace().add(rigidBodyControl);
    }
1 Like