public void setBall(double x, double y, double z, AppearanceDefinition appearance, int ballIndex) { if (ballIndex < yoGraphicPositions.size()) { YoGraphicPosition yoGraphicPosition = yoGraphicPositions.get(ballIndex); yoGraphicPosition.setPosition(x, y, z); if (appearance != null) yoGraphicPosition.setAppearance(appearance); } else { if (!outOfBallsWarning) { // System.err.println("Bag of Balls doesn't have enough footstep graphic positions!"); outOfBallsWarning = true; } } }
public void setBall(double x, double y, double z, AppearanceDefinition appearance, int ballIndex) { if (ballIndex < dynamicGraphicPositions.size()) { YoGraphicPosition dynamicGraphicPosition = dynamicGraphicPositions.get(ballIndex); dynamicGraphicPosition.setPosition(x, y, z); if (appearance != null) dynamicGraphicPosition.setAppearance(appearance); } else { if (!this.outOfBallsWarning) { // System.err.println("Bag of Balls doesn't have enough footstep graphic positions!"); this.outOfBallsWarning = true; } } }
/** * Sets the next ball to the given location with the given Appearance. If all the balls have been * set, then loops to the first ball. * * @param location FramePoint to set the next ball to. * @param appearance Appearance to give the next ball. */ public void setBallLoop(FramePoint3DReadOnly location, AppearanceDefinition appearance) { location.checkReferenceFrameMatch(worldFrame); if (index >= yoGraphicPositions.size()) { index = 0; } YoGraphicPosition yoGraphicPosition = yoGraphicPositions.get(index); yoGraphicPosition.setPosition(location); if (appearance != null) yoGraphicPosition.setAppearance(appearance); index++; }
/** * Sets the next ball to the given location with the given Appearance. If all the balls have been set, then loops to the first ball. * * @param location FramePoint to set the next ball to. * @param appearance Appearance to give the next ball. */ public void setBallLoop(FramePoint location, AppearanceDefinition appearance) { location.changeFrame( ReferenceFrame.getWorldFrame()); if (index >= dynamicGraphicPositions.size()) { index = 0; } YoGraphicPosition dynamicGraphicPosition = dynamicGraphicPositions.get(index); dynamicGraphicPosition.setPosition(location); if (appearance != null) dynamicGraphicPosition.setAppearance(appearance); index++; }