|
@@ -10,11 +10,14 @@ import com.jme3.bullet.collision.shapes.HeightfieldCollisionShape;
|
|
import com.jme3.bullet.control.CharacterControl;
|
|
import com.jme3.bullet.control.CharacterControl;
|
|
import com.jme3.bullet.control.RigidBodyControl;
|
|
import com.jme3.bullet.control.RigidBodyControl;
|
|
import com.jme3.input.KeyInput;
|
|
import com.jme3.input.KeyInput;
|
|
|
|
+import com.jme3.input.MouseInput;
|
|
import com.jme3.input.controls.ActionListener;
|
|
import com.jme3.input.controls.ActionListener;
|
|
import com.jme3.input.controls.KeyTrigger;
|
|
import com.jme3.input.controls.KeyTrigger;
|
|
|
|
+import com.jme3.input.controls.MouseButtonTrigger;
|
|
import com.jme3.material.Material;
|
|
import com.jme3.material.Material;
|
|
import com.jme3.math.ColorRGBA;
|
|
import com.jme3.math.ColorRGBA;
|
|
import com.jme3.math.Vector3f;
|
|
import com.jme3.math.Vector3f;
|
|
|
|
+import com.jme3.terrain.Terrain;
|
|
import com.jme3.terrain.geomipmap.TerrainGrid;
|
|
import com.jme3.terrain.geomipmap.TerrainGrid;
|
|
import com.jme3.terrain.geomipmap.TerrainGridListener;
|
|
import com.jme3.terrain.geomipmap.TerrainGridListener;
|
|
import com.jme3.terrain.geomipmap.TerrainGridLodControl;
|
|
import com.jme3.terrain.geomipmap.TerrainGridLodControl;
|
|
@@ -164,11 +167,13 @@ public class TerrainGridTileLoaderTest extends SimpleApplication {
|
|
this.inputManager.addMapping("Ups", new KeyTrigger(KeyInput.KEY_W));
|
|
this.inputManager.addMapping("Ups", new KeyTrigger(KeyInput.KEY_W));
|
|
this.inputManager.addMapping("Downs", new KeyTrigger(KeyInput.KEY_S));
|
|
this.inputManager.addMapping("Downs", new KeyTrigger(KeyInput.KEY_S));
|
|
this.inputManager.addMapping("Jumps", new KeyTrigger(KeyInput.KEY_SPACE));
|
|
this.inputManager.addMapping("Jumps", new KeyTrigger(KeyInput.KEY_SPACE));
|
|
|
|
+ this.inputManager.addMapping("pick", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
|
|
this.inputManager.addListener(this.actionListener, "Lefts");
|
|
this.inputManager.addListener(this.actionListener, "Lefts");
|
|
this.inputManager.addListener(this.actionListener, "Rights");
|
|
this.inputManager.addListener(this.actionListener, "Rights");
|
|
this.inputManager.addListener(this.actionListener, "Ups");
|
|
this.inputManager.addListener(this.actionListener, "Ups");
|
|
this.inputManager.addListener(this.actionListener, "Downs");
|
|
this.inputManager.addListener(this.actionListener, "Downs");
|
|
this.inputManager.addListener(this.actionListener, "Jumps");
|
|
this.inputManager.addListener(this.actionListener, "Jumps");
|
|
|
|
+ this.inputManager.addListener(this.actionListener, "pick");
|
|
}
|
|
}
|
|
private boolean left;
|
|
private boolean left;
|
|
private boolean right;
|
|
private boolean right;
|
|
@@ -204,6 +209,10 @@ public class TerrainGridTileLoaderTest extends SimpleApplication {
|
|
}
|
|
}
|
|
} else if (name.equals("Jumps")) {
|
|
} else if (name.equals("Jumps")) {
|
|
TerrainGridTileLoaderTest.this.player3.jump();
|
|
TerrainGridTileLoaderTest.this.player3.jump();
|
|
|
|
+ } else if (name.equals("pick") && keyPressed) {
|
|
|
|
+ //Terrain picked = terrain.getTerrainAt(player3.getPhysicsLocation());
|
|
|
|
+ Terrain picked = terrain.getTerrainAtCell(terrain.getCurrentCell());
|
|
|
|
+ System.out.println("** cell "+player3.getPhysicsLocation()+" picked terrain: "+picked);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|