/** * This method is called once per frame to update the positional and rotational data needed to * process a Sound Node. * * @param viewTransform the Transform3D of the current View */ private void update(View view, Point3f listenerPosition) { if ((soundDriver != null) && soundDriver.isOnline()) { Vector3f facingDirection = Vector3f.fromPool(); Vector3f upDirection = Vector3f.fromPool(); soundDriver.setListenerPosition(listenerPosition); view.getFacingDirection(facingDirection); // .normalize(); view.getUpDirection(upDirection); // .normalize(); soundDriver.setListenerOrientation(facingDirection, upDirection); Vector3f.toPool(upDirection); Vector3f.toPool(facingDirection); } }
@Override protected Vector3f calculateRandomValue(Vector3f original, Vector3f random) { temp = new Vector3f(); temp.setX(original.getX() + generator.getFloat(random.getX()) - random.getX() * 0.5f); temp.setY(original.getY() + generator.getFloat(random.getY()) - random.getY() * 0.5f); temp.setZ(original.getZ() + generator.getFloat(random.getZ()) - random.getZ() * 0.5f); return temp; }