public void showCar() {
    for (int i = 0; i < 4; i++) {
      cars[i] = factory.getCar(car_names[i], assetManager);
      car_con[i] = cars[i].getControl(VehicleControl.class);
    }
    Camera camera = cam.clone();

    camera.setViewPort(.25f, .9f, .1f, .75f);
    carView = this.app.getRenderManager().createPostView("carview", camera);

    space.add(car_con[index]);
    dl = new DirectionalLight();
    localRootNode.addLight(dl);
    ai = new AmbientLight();
    localRootNode.addLight(ai);
    car_con[index].setPhysicsLocation(new Vector3f(0, 1, 0));
    localRootNode.attachChild(cars[index]);
    floor = assetManager.loadModel("Models/garage/garage.mesh.j3o");
    control = new RigidBodyControl(0);
    floor.addControl(control);
    control.setPhysicsLocation(Vector3f.ZERO);
    space.add(control);
    localRootNode.attachChild(floor);

    camera.setLocation(car_con[index].getPhysicsLocation().add(new Vector3f(3, 1f, 0)));
    camera.lookAt(car_con[index].getPhysicsLocation().add(new Vector3f(0, -1, 0)), Vector3f.UNIT_Y);
    dl.setDirection(camera.getDirection());

    carView.attachScene(localRootNode);
  }
  public Characters(SimpleApplication app) {
    assetManager = app.getAssetManager();

    characters =
        new Object[][] {
          {"Tahu", assetManager.loadModel("Models/Characters/Tahu/Tahu.mesh.j3o"), 90, 30, 30},
          {2, 3, 4},
          {4, 5, 2}
        };
  }
 /**
  * gets an effect from the list (is exists) or loads a new one
  *
  * @param name
  * @return
  */
 private Node getEffect(String name) {
   if (emitters.get(name) == null) {
     emitters.put(name, new LinkedList<Node>());
   }
   Node emit = emitters.get(name).poll();
   if (emit == null) {
     emit = (Node) assetManager.loadModel(name);
   }
   return emit;
 }
예제 #4
0
 public void createMonster() {
   Monster monster = new Monster();
   monster.health = 20;
   monster.attackDelay = 0;
   monster.monsterControl = new BetterCharacterControl(1f, 5f, 1f);
   monster.Model = (Node) assetManager.loadModel("Models/RealMonster/RealMonster.j3o");
   monster.Model.setLocalScale(.8f);
   monster.Model.addControl(monster.monsterControl);
   monster.monsterControl.setGravity(new Vector3f(0f, -9.81f, 0f));
   monster.anim = new AnimationManager();
   monster.anim.animationInit(monster.Model);
   physics.getPhysicsSpace().add(monster.monsterControl);
   monster.attachChild(monster.Model);
   monsterNode.attachChild(monster);
   monster.monsterSetLocation(monster);
 }
예제 #5
0
 /**
  * Constructor
  *
  * @param assetManager to load models
  */
 public BargeShip(AssetManager assetManager) {
   bargeship = assetManager.loadModel("Models/Ship/BargeShip/BargeBoot.j3o");
   bargeship.setCullHint(cullHint.Dynamic);
   bargeship.scale(3);
   attachChild(bargeship);
 }