rootNode.attachChild(box);
}
// Fetch the world translation for the root node of the cell and set
// the translation for this entity root node
CellTransform transform = cell.getWorldTransform();
rootNode.setLocalTranslation(transform.getTranslation(null));
rootNode.setLocalRotation(transform.getRotation(null));
// OWL issue #61: make sure to take scale into account
rootNode.setLocalScale(transform.getScaling(null));
// Listen for changes to the cell's translation and apply the same
// update to the root node of the bounds viewer. We also re-set the size
// of the bounds: this handles the case where the bounds of the
// scene graph has changed and we need to update the bounds viewer
// accordingly.
updateListener = new TransformChangeListener() {
public void transformChanged(final Cell cell, ChangeSource source) {
// We need to perform this work inside a proper updater, to
// make sure we are MT thread safe
final WorldManager wm = ClientContextJME.getWorldManager();
RenderUpdater u = new RenderUpdater() {
public void update(Object obj) {
CellTransform transform = cell.getWorldTransform();
rootNode.setLocalTranslation(transform.getTranslation(null));
rootNode.setLocalRotation(transform.getRotation(null));
rootNode.setLocalScale(transform.getScaling(null));
wm.addToUpdateList(rootNode);
}
};
wm.addRenderUpdater(u, this);
}