Game Development Reference
In-Depth Information
3. In the
setSpatial
method, we create the upper and lower channels in
Anim-
Control
. We let
AnimChannel
add all the bones recursively using the
ad-
dFromRootBone
method, as shown in the following code:
public void setSpatial(Spatial spatial) {
super.setSpatial(spatial);
animControl = spatial.getControl(AnimControl.class);
upperChannel = animControl.createChannel();
lowerChannel = animControl.createChannel();
upperChannel.addFromRootBone("spine");
lowerChannel.addBone("Root");
lowerChannel.addFromRootBone("pelvis");