예제 #1
0
 public void setServerElementStraf(ServerElement element, Float straf) {
   // log.debug("accel");
   synchronized (directionVector) {
     setRightDirectionVector(element);
     directionVector.scale(straf);
     RigidBody rb = elementToRigidBody.get(element);
     rb.applyCentralForce(directionVector);
     // rb.setLinearVelocity(directionVector);
   }
 }
예제 #2
0
  public void setServerElementForce(ServerElement element) {
    // log.debug("accel");
    synchronized (directionVector) {
      RigidBody rb = elementToRigidBody.get(element);
      Vector3f velocity = new Vector3f();
      rb.getLinearVelocity(velocity);
      velocity.scale(-1f);
      rb.applyCentralForce(velocity);

      Vector3f angularVelocity = new Vector3f();
      rb.getAngularVelocity(angularVelocity);
      angularVelocity.scale(-0.5f);
      rb.applyTorque(angularVelocity);
      // rb.setLinearVelocity(directionVector);

    }
  }
예제 #3
0
 public void applyForce(Vector3f vec) {
   activate();
   body.applyCentralForce(vec);
 }