if (prevTrans == null || !Math3DUtils.epsilonEquals(prevTrans, translation, 0.001f) ||
prevRot == null || !prevRot.epsilonEquals(rotation, 0.001f) ||
!Math3DUtils.epsilonEquals(prevHeight, height, 0.001f) ||
prevCollision != collision)
{
MovableAvatarComponent mac = ((MovableAvatarComponent) c.getComponent(MovableComponent.class));
mac.localMoveRequest(new CellTransform(rotation.getRotation(), translation), height, collision);
prevTrans = translation.clone();
prevRot = new PMatrix(rotation);
prevHeight = height;
prevCollision = collision;
}
};
};
// This info will be sent to the other clients to animate the avatar
gameContextListener = new GameContextListener() {
public void trigger(boolean pressed, int trigger, Vector3f translation, Quaternion rotation) {
synchronized (this) {
currentTrigger = trigger;
currentPressed = pressed;
}
String animationName = null;
// OWL issue #237 - regardless of the current state, send the
// animation that is currently set in CycleActionState. This
// is consistent with the behavior of
// WlAvatarContext.setMiscAnimation() used in the trigger()
// method below
CycleActionState cas = (CycleActionState)
avatarCharacter.getContext().getState(CycleActionState.class);
if (cas != null) {
animationName = cas.getAnimationName();
}
float height = avatarCharacter.getController().getHeight();
boolean collision = avatarCharacter.getController().isColliding();
if (c.getComponent(MovableComponent.class)==null) {
logger.warning("!!!! NULL MovableComponent");
} else {
MovableAvatarComponent mac = ((MovableAvatarComponent) c.getComponent(MovableComponent.class));
mac.localMoveRequest(new CellTransform(rotation, translation),
trigger, pressed, animationName,
height, collision, null);
}
}