// Attach the name tag to the new avatar and add the avatar entity to
// the cell renderer root entity and turn on input.
Node externalRoot = avatarCharacter.getJScene().getExternalKidsRoot();
if (nameTagNode!=null) {
externalRoot.attachChild(nameTagNode);
externalRoot.setModelBound(new BoundingSphere());
externalRoot.updateModelBound();
externalRoot.updateGeometricState(0, true);
}
rootEntity.addEntity(avatarCharacter);
// Turn on input handle for the renderer, if we wish. Check for AvatarCell
// to allow NPC's to work
if (cell instanceof AvatarCell) {
selectForInput(((AvatarCell) cell).isSelectedForInput());
}
// Notify listeners that the avatar has changed.
for (WeakReference<AvatarChangedListener> listenerRef : avatarChangedListeners) {
AvatarChangedListener listener = listenerRef.get();
if (listener != null) {
listener.avatarChanged(avatarCharacter);
}
else {
avatarChangedListeners.remove(listenerRef);
}
}
// update the bounds if necessary
if (avatarCharacter.getJScene() != null) {
avatarCharacter.getPScene().submitTransformsAndGeometry(true);
avatarCharacter.getJScene().setModelBound(new BoundingSphere());
avatarCharacter.getJScene().updateModelBound();
avatarCharacter.getJScene().updateWorldBound();
}
// Update pick geometry