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 onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { if (channel.getAnimationName().equals("SliceHorizontal")) { channel.setLoopMode(LoopMode.DontLoop); channel.setAnim("IdleTop", 5); channel.setLoopMode(LoopMode.Loop); } }
feet.addFromRootBone("hip.right"); feet.addFromRootBone("hip.left"); feet.setAnim("Dodge"); feet.setSpeed(2); feet.setLoopMode(LoopMode.Cycle); feet.setAnim("Walk", 15); feet.setSpeed(0.25f); feet.setLoopMode(LoopMode.Cycle); leftHand.addFromRootBone("uparm.right"); leftHand.setAnim("pull"); leftHand.setSpeed(.5f); leftHand.setAnim("stand", 15); rightHand.addBone("spinehigh"); rightHand.addFromRootBone("uparm.left"); rightHand.setAnim("push");
@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 setTime(float time) { super.setTime(time); if (!animationName.equals(channel.getAnimationName())) { channel.setAnim(animationName, blendTime); t = t % channel.getAnimMaxTime(); float parity = (float) Math.ceil(time / channel.getAnimMaxTime()); if (parity > 0 && parity % 2 == 0) { t = channel.getAnimMaxTime() - t % channel.getAnimMaxTime(); } else { t = t % channel.getAnimMaxTime(); channel.setTime(0); channel.reset(true); if (t > channel.getAnimMaxTime()) { channel.setTime(t); channel.getControl().update(0); stop(); } else { channel.setTime(t); channel.getControl().update(0);
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); } } }
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { if (channel == shootingChannel) { channel.setAnim("stand"); } }
if (action.equals(SpatialAnimMgr.ControlAction.PLAY)) { myLogger.info("Playing thing animation {}", uri); LoopMode desiredLoopMode = channel.getLoopMode(); channel.setAnim(uri.getLocalName(), 0f); channel.setLoopMode(desiredLoopMode); } else if (action.equals(SpatialAnimMgr.ControlAction.STOP)) {
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); }
@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); } } });
if (animControl != null) { // Not all are anims AnimChannel channel = animControl.getChannel(0); LoopMode loopMode = channel.getLoopMode(); channel.setAnim(ANIM_NAME, 0); if (loopMode != null) { channel.setLoopMode(loopMode); channel.setTime(Integer.MAX_VALUE);
chan.setSpeed(a.getSpeed()); if(!a.getName().equals(chan.getAnimationName())) chan.setAnim(a.getName());
if (!"stand".equals(animationChannel.getAnimationName())) { animationChannel.setAnim("stand", 1f); if (!"stand".equals(animationChannel.getAnimationName())) { animationChannel.setAnim("stand"); } else if (!"Walk".equals(animationChannel.getAnimationName())) { animationChannel.setAnim("Walk", 0.7f);
@Override public void setLoopMode(LoopMode loopMode) { super.setLoopMode(loopMode); if (channel != null) { channel.setLoopMode(loopMode); } }
/** * Add bones to be influenced by this animation channel, starting * from the given bone and going toward its children. */ public void addFromRootBone(Bone bone) { addBone(bone); if (bone.getChildren() == null) return; for (Bone childBone : bone.getChildren()) { addBone(childBone); addFromRootBone(childBone); } }
@Override public void setSpeed(float speed) { super.setSpeed(speed); if (channel != null) { channel.setSpeed(speed); } }