@Override public void setSpatial(final Spatial spatial) { super.setSpatial(spatial); if (spatial instanceof Node) { ((Node) spatial).attachChild(head); } }
@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())); }
@Override public void setWalkDirection(final Vector3f vec) { super.setWalkDirection(walkDirection); }