public void update(float delta) {
    addQueuedBodies();

    try {
      _discreteDynamicsWorld.stepSimulation(delta, 3);
    } catch (Exception e) {
      _logger.log(
          Level.WARNING,
          "Somehow Bullet Physics managed to throw an exception again. Go along: " + e.toString());
    }

    updateChunks();
    removeTemporaryBlocks();
    checkForLootedBlocks();
  }
示例#2
0
  // Vector3f turnVector = new Vector3f(0f,2f,0f);
  // Vector3f turnInvVector = new Vector3f(0f,-2f,0f);
  public synchronized void step(Integer milliseconds) {

    Boolean commanded;
    for (ServerPlayer p : players) {
      commanded = false;
      if (p.getAccel() != 0f) {
        setServerElementAccel(p, p.getAccel());
        p.setAccel(0f);
        commanded = true;
      }

      if (p.getStraf() != 0f) {
        setServerElementStraf(p, p.getStraf());
        p.setStraf(0f);
        commanded = true;
      }

      if (p.getTurn() != 0f) {
        setElementRotation(p, p.getTurn());
        p.setTurn(0f);
        commanded = true;
      }

      if (commanded) {

      } else {
        setServerElementForce(p);
      }
    }

    updateRigidBodys();

    // dynamicsWorld.stepSimulation(1.f / 30.f, 10);
    dynamicsWorld.stepSimulation(milliseconds, 2);

    updateServerElements();
  }