@Override public void onPause() { if (channel != null) { channel.getControl().setEnabled(false); } }
@Override public void onPlay() { channel.getControl().setEnabled(true); if (playState == PlayState.Stopped) { channel.setAnim(animationName, blendTime); channel.setSpeed(speed); channel.setLoopMode(loopMode); channel.setTime(0); } }
this.mode = mode; AnimControl animControl = targetModel.getControl(AnimControl.class); animControl.setEnabled(mode == Mode.Kinematic);
this.mode = mode; AnimControl animControl = targetModel.getControl(AnimControl.class); animControl.setEnabled(mode == Mode.Kinematic);
mode = Mode.Kinematic; AnimControl animControl = targetModel.getControl(AnimControl.class); animControl.setEnabled(true);
mode = Mode.Kinematic; AnimControl animControl = targetModel.getControl(AnimControl.class); animControl.setEnabled(true);
@Override public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { // Stop us control.setEnabled(false); // Signal stop animationControl.onAnimationStop(); }
@Override public void onPause() { if (channel != null) { channel.getControl().setEnabled(false); } }
private AnimControl createAnimControl(Node parent, DAENode animationsNode, List<DAENode> geomElementList, Skeleton skeleton) { Mesh[] meshes = new Mesh[geomElementList.size()]; int index = 0; for (DAENode geomNode : geomElementList) { meshes[index] = geomNode.getParsedData(Mesh.class); index++; } Animation[] animations = createAnimations(animationsNode, skeleton); AnimControl animation = new AnimControl(skeleton); animation.setAnimations(new HashMap<String, Animation>()); for (Animation Animation : animations) { animation.addAnim(Animation); } animation.setEnabled(false); return animation; }
public void onAction(String string, boolean bln, float f) { if (controlledAnimation != null) { AnimChannel channel = controlledAnimation.createChannel(); channel.setSpeed(0.001f); channel.setAnim("l_hip_rotateY"); controlledAnimation.setEnabled(!controlledAnimation.isEnabled()); } } }, "animate");
private static void hideAllNodes(Node root) { UnitFlowerControl aufc = root.getControl(UnitFlowerControl.class); for (Spatial child : root.getChildren()) { // Don't hide the unit flower if (Boolean.FALSE.equals(child.getUserData(AssetUtils.USER_DATA_KEY_REMOVABLE))) { continue; } child.setCullHint(Spatial.CullHint.Always); // Also stop any animations AnimControl animControl = (AnimControl) child.getControl(AnimControl.class); if (animControl != null) { animControl.setEnabled(false); } } }
@Override public void onPlay() { channel.getControl().setEnabled(true); if (playState == PlayState.Stopped) { channel.setAnim(animationName, blendTime); channel.setSpeed(speed); channel.setLoopMode(loopMode); channel.setTime(0); } }
@Override public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { // Start the real animation Spatial spat = root.getChild(resource.getName()); AnimControl animControl = spat.getControl(AnimControl.class); spat.setCullHint(Spatial.CullHint.Inherit); AnimChannel c = animControl.getChannel(0); LoopMode loopMode = c.getLoopMode(); c.setAnim(ANIM_NAME, 0); if (loopMode != null) { c.setLoopMode(loopMode); } animControl.setEnabled(true); // Hide us control.setEnabled(false); control.getSpatial().setCullHint(Spatial.CullHint.Always); }
/** * Enable or disable the ragdoll behaviour. * if ragdollEnabled is true, the character motion will only be powerd by physics * else, the characted will be animated by the keyframe animation, * but will be able to physically interact with its physic environnement * @param ragdollEnabled */ protected void setMode(Mode mode) { this.mode = mode; AnimControl animControl = targetModel.getControl(AnimControl.class); animControl.setEnabled(mode == Mode.Kinetmatic); baseRigidBody.setKinematic(mode == Mode.Kinetmatic); TempVars vars = TempVars.get(); for (PhysicsBoneLink link : boneLinks.values()) { link.rigidBody.setKinematic(mode == Mode.Kinetmatic); if (mode == Mode.Ragdoll) { Quaternion tmpRot1 = vars.quat1; Vector3f position = vars.vect1; //making sure that the ragdoll is at the correct place. matchPhysicObjectToBone(link, position, tmpRot1); } } vars.release(); for (Bone bone : skeleton.getRoots()) { RagdollUtils.setUserControl(bone, mode == Mode.Ragdoll); } }
this.mode = mode; AnimControl animControl = targetModel.getControl(AnimControl.class); animControl.setEnabled(mode == Mode.Kinematic);
@Override public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { cyclesCount++; // Signal that the main animation cycle is done animationControl.onAnimationCycleDone(); // See if we need to stop if (animationControl.isStopAnimation() || channel.getLoopMode() == LoopMode.DontLoop) { // Stop us control.setEnabled(false); // We need to stop if (resource.getFlags().contains(ArtResource.ArtResourceFlag.HAS_END_ANIMATION)) { // Hide us control.getSpatial().setCullHint(Spatial.CullHint.Always); Spatial spat = root.getChild(END_ANIMATION_NAME); AnimControl animControl = spat.getControl(AnimControl.class); spat.setCullHint(Spatial.CullHint.Inherit); AnimChannel c = animControl.getChannel(0); LoopMode loopMode = c.getLoopMode(); c.setAnim(ANIM_NAME, 0); if (loopMode != null) { c.setLoopMode(loopMode); } animControl.setEnabled(true); } else { // Signal stop animationControl.onAnimationStop(); } } }
this.mode = mode; AnimControl animControl = targetModel.getControl(AnimControl.class); animControl.setEnabled(mode == Mode.Kinematic);
mode = Mode.Kinetmatic; AnimControl animControl = targetModel.getControl(AnimControl.class); animControl.setEnabled(true);
mode = Mode.Kinematic; AnimControl animControl = targetModel.getControl(AnimControl.class); animControl.setEnabled(true);
mode = Mode.Kinematic; AnimControl animControl = targetModel.getControl(AnimControl.class); animControl.setEnabled(true);