示例#1
0
 @Override
 public void setSpatial(final Spatial spatial) {
   super.setSpatial(spatial);
   if (spatial instanceof Node) {
     ((Node) spatial).attachChild(head);
   }
 }
示例#2
0
 @Override
 public void update(final float tpf) {
   super.update(tpf);
   final Vector3f modelForwardDir = spatial.getWorldRotation().mult(Vector3f.UNIT_Z);
   final Vector3f modelLeftDir = spatial.getWorldRotation().mult(Vector3f.UNIT_X);
   walkDirection.set(0, 0, 0);
   if (forward) {
     walkDirection.addLocal(modelForwardDir.mult(avatar.forwardSpeed(running)));
   } else if (backward) {
     walkDirection.addLocal(modelForwardDir.negate().mult(avatar.backwardSpeed(running)));
   }
   if (leftStrafe) {
     walkDirection.addLocal(modelLeftDir.mult(avatar.sideSpeed(running)));
   } else if (rightStrafe) {
     walkDirection.addLocal(modelLeftDir.negate().mult(avatar.sideSpeed(running)));
   }
   this.avatar.setLocation(convertVectorToArray(spatial.getLocalTranslation()));
 }
示例#3
0
 @Override
 public void setWalkDirection(final Vector3f vec) {
   super.setWalkDirection(walkDirection);
 }