@Override public void setLoopMode(LoopMode loopMode) { super.setLoopMode(loopMode); if (channel != null) { channel.setLoopMode(loopMode); } }
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { if (channel.getAnimationName().equals("SliceHorizontal")) { channel.setLoopMode(LoopMode.DontLoop); channel.setAnim("IdleTop", 5); channel.setLoopMode(LoopMode.Loop); } }
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { // if(channel.getAnimationName().equals("StandUpFront")){ // channel.setAnim("Dance"); // } if (channel.getAnimationName().equals("StandUpBack") || channel.getAnimationName().equals("StandUpFront")) { channel.setLoopMode(LoopMode.DontLoop); channel.setAnim("IdleTop", 5); channel.setLoopMode(LoopMode.Loop); } // if(channel.getAnimationName().equals("IdleTop")){ // channel.setAnim("StandUpFront"); // } }
public void onAction(String name, boolean keyPressed, float tpf) { if (name.equals("Walk") && !keyPressed) { if (!channel.getAnimationName().equals("Walk")) { /** Play the "walk" animation! */ channel.setAnim("Walk", 0.50f); channel.setLoopMode(LoopMode.Loop); } } } };
/** Use this listener to trigger something after an animation is done. */ public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { if (animName.equals("Walk")) { /** After "walk", reset to "stand". */ channel.setAnim("stand", 0.50f); channel.setLoopMode(LoopMode.DontLoop); channel.setSpeed(1f); } }
@Override public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { if (animName.equals("Punches")) { channel.setAnim("Idle", 0.5f); channel.setLoopMode(LoopMode.DontLoop); channel.setSpeed(1f); } }
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { if (animName.equals("Dodge")){ channel.setAnim("stand", 0.50f); channel.setLoopMode(LoopMode.DontLoop); channel.setSpeed(1f); } }
public void onAction(String binding, boolean value, float tpf) { if (binding.equals("Attack") && value){ if (!channel.getAnimationName().equals("Dodge")){ channel.setAnim("Dodge", 0.50f); channel.setLoopMode(LoopMode.Cycle); channel.setSpeed(0.10f); } } }
@Override public void onAction(String binding, boolean value, float tpf) { if (binding.equals("Attack") && value) { if (!channel.getAnimationName().equals("Punches")) { channel.setAnim("Punches", 0.5f); channel.setLoopMode(LoopMode.Cycle); channel.setSpeed(0.5f); } } } }
@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); } }
private void bulletControl() { shootingChannel.setAnim("Dodge", 0.1f); shootingChannel.setLoopMode(LoopMode.DontLoop); Geometry bulletg = new Geometry("bullet", bullet); bulletg.setMaterial(matBullet); bulletg.setShadowMode(ShadowMode.CastAndReceive); bulletg.setLocalTranslation(character.getPhysicsLocation().add(cam.getDirection().mult(5))); RigidBodyControl bulletControl = new BombControl(bulletCollisionShape, 1); bulletControl.setCcdMotionThreshold(0.1f); bulletControl.setLinearVelocity(cam.getDirection().mult(80)); bulletg.addControl(bulletControl); rootNode.attachChild(bulletg); getPhysicsSpace().add(bulletControl); }
feet.setAnim("Dodge"); feet.setSpeed(2); feet.setLoopMode(LoopMode.Cycle); feet.setLoopMode(LoopMode.Cycle);
channel.setLoopMode(LoopMode.DontLoop); SkeletonControl skeletonControl = model.getControl(SkeletonControl.class);
@Override public void setLoopMode(LoopMode loopMode) { super.setLoopMode(loopMode); if (channel != null) { channel.setLoopMode(loopMode); } }
public static void setLoopModeOnChannel(final Spatial spat, final AnimChannel channel) { final Anim.FrameFactorFunction func = Anim.FrameFactorFunction.valueOf(spat.getUserData(KmfModelLoader.FRAME_FACTOR_FUNCTION)); switch (func) { case CLAMP: { channel.setLoopMode(LoopMode.Cycle); break; } case WRAP: { channel.setLoopMode(LoopMode.Loop); break; } } }
@Override public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { super.onAnimCycleDone(control, channel, animName); // if(channel.getAnimationName().equals("StandUpFront")){ // channel.setAnim("Dance"); // } if (channel.getAnimationName().equals(ANIM_STAND_BACK) || channel.getAnimationName().equals(ANIM_STAND_FRONT)) { channel.setLoopMode(LoopMode.DontLoop); channel.setAnim(ANIM_IDLE_TOP, 5); channel.setLoopMode(LoopMode.Loop); } // if(channel.getAnimationName().equals("IdleTop")){ // channel.setAnim("StandUpFront"); // } } }
@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 visit(Spatial spatial) { AnimControl animControl = spatial.getControl(AnimControl.class); if (animControl != null) { AnimChannel channel = animControl.createChannel(); channel.setAnim("anim"); channel.setLoopMode(LoopMode.Loop); if (randomizeAnimation) { channel.setSpeed(FastMath.nextRandomInt(6, 10) / 10f); channel.setTime(FastMath.nextRandomFloat() * channel.getAnimMaxTime()); } // Don't batch animated objects, seems not to work object.setBatchHint(Spatial.BatchHint.Never); } } });
@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); }
protected void moveViaAnimation(Vector3f newPosition, Quaternion newOrientation, Vector3f newScale, float duration) { final String moveAnimName = "BasicGoodyMoveFactory"; AnimationFactory aniFactory = new AnimationFactory(duration, moveAnimName); // First add starting position/rotation/scale to timeline at index 0 aniFactory.addKeyFrameTranslation(0, myPosition); aniFactory.addKeyFrameRotation(0, getTotalRotation(getCurrentAttachedGeomBinding())); aniFactory.addKeyFrameScale(0, myScaleVec); // Now add new position/rotation/scale at duration: setNewPositionAndRotationIfNonNull(newPosition, newOrientation); if (newScale != null) { myScaleVec = newScale; } aniFactory.addTimeTranslation(duration, myPosition); aniFactory.addTimeRotation(duration, getTotalRotation(getCurrentAttachedGeomBinding())); aniFactory.addTimeScale(duration, myScaleVec); // Finally the Animation is generated and linked to the geometry via an AnimationControl Animation moveAnimation = aniFactory.buildAnimation(); AnimControl goodyControl = new AnimControl(); // Should this be retained for reuse? goodyControl.addAnim(moveAnimation); getCurrentAttachedGeometry().addControl(goodyControl); AnimChannel moveChannel = goodyControl.createChannel(); moveChannel.setAnim(moveAnimName, 0f); // Oddly, it seems this needs to be set *after* starting the animation with setAnim: moveChannel.setLoopMode(LoopMode.DontLoop); }