Game Development Reference
In-Depth Information
The AnimationEvent patch
The following code snippet shows the patch needed for the Lip syncing and facial expres-
sions recipe of Chapter 4 , Mastering Character Animations . Apply this to the file in your
project. If you're applying it manually, the constructor must be added to Anima-
tionEvent , and the following lines of code have to go into the initEvent method just
after cinematic.putEventData(MODEL_CHANNELS, model, s); :
int numChannels =
model.getControl(AnimControl.class).getNumChannels();
for(int i = 0; i < numChannels; i++){
((HashMap<Integer, AnimChannel>)s).put(i,
model.getControl(AnimControl.class).getChannel(i));
}
The full patch is:
Index: AnimationEvent.java
===================================================================
— AnimationEvent.java (revision 11001)
+++ AnimationEvent.java (working copy)
@@ -221,6 +221,24 @@
initialDuration =
model.getControl(AnimControl.class).getAnimationLength(animationName);
this.channelIndex = channelIndex;
}
+
+/**
+ * creates an animation event
+ *
+ * @param model the model on which the animation will be
played
+ * @param animationName the name of the animation to play
+ * @param channelIndex the index of the channel default is
0. Events on the
+ * @param blendTime the time during the animation are going
to be blended
+ * same channelIndex will use the same channel.
Search WWH ::




Custom Search