Java Code Examples for com.jme3.animation.AnimChannel#setSpeed()
The following examples show how to use
com.jme3.animation.AnimChannel#setSpeed() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PauseAnimationAction.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
@Override @FxThread protected void process() { super.process(); final AnimationTreeNode modelNode = (AnimationTreeNode) getNode(); if (modelNode.getChannel() < 0) return; final AnimControl control = modelNode.getControl(); if (control == null || control.getNumChannels() <= 0) return; final AnimChannel channel = control.getChannel(modelNode.getChannel()); channel.setSpeed(0); modelNode.setSpeed(0); final NodeTree<ModelChangeConsumer> nodeTree = getNodeTree(); nodeTree.update(modelNode); }
Example 2
Source File: AnimationPerformer.java From OpenRTS with MIT License | 6 votes |
@Override public void perform(Actor a) { AnimationActor actor = (AnimationActor)a; if(actor.launched) { return; } actor.launched = true; Spatial s = actor.getParentModelActor().getViewElements().spatial; AnimChannel channel = s.getControl(AnimControl.class).getChannel(0); channel.setAnim(actor.animName); switch (actor.cycle){ case Once : channel.setLoopMode(LoopMode.DontLoop); break; case Loop : channel.setLoopMode(LoopMode.Loop); break; case Cycle : channel.setLoopMode(LoopMode.Cycle); break; } channel.setSpeed((float)actor.speed); }
Example 3
Source File: TestAttachmentsNode.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@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); } }
Example 4
Source File: HelloAnimation.java From chuidiang-ejemplos with GNU Lesser General Public License v3.0 | 5 votes |
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { if (animName.equals("Walk")) { channel.setAnim("stand", 0.50f); channel.setLoopMode(LoopMode.DontLoop); channel.setSpeed(1f); } }
Example 5
Source File: HelloAnimation.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
/** 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); } }
Example 6
Source File: TestOgreAnim.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
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); } }
Example 7
Source File: TestOgreComplexAnim.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void simpleInitApp() { flyCam.setMoveSpeed(10f); cam.setLocation(new Vector3f(6.4013605f, 7.488437f, 12.843031f)); cam.setRotation(new Quaternion(-0.060740203f, 0.93925786f, -0.2398315f, -0.2378785f)); DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal()); dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f)); rootNode.addLight(dl); Node model = (Node) assetManager.loadModel("Models/Oto/Oto.mesh.xml"); control = model.getControl(AnimControl.class); AnimChannel feet = control.createChannel(); AnimChannel leftHand = control.createChannel(); AnimChannel rightHand = control.createChannel(); // feet will dodge feet.addFromRootBone("hip.right"); feet.addFromRootBone("hip.left"); feet.setAnim("Dodge"); feet.setSpeed(2); feet.setLoopMode(LoopMode.Cycle); // will blend over 15 seconds to stand feet.setAnim("Walk", 15); feet.setSpeed(0.25f); feet.setLoopMode(LoopMode.Cycle); // left hand will pull leftHand.addFromRootBone("uparm.right"); leftHand.setAnim("pull"); leftHand.setSpeed(.5f); // will blend over 15 seconds to stand leftHand.setAnim("stand", 15); // right hand will push rightHand.addBone("spinehigh"); rightHand.addFromRootBone("uparm.left"); rightHand.setAnim("push"); SkeletonDebugger skeletonDebug = new SkeletonDebugger("skeleton", control.getSkeleton()); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.getAdditionalRenderState().setWireframe(true); mat.setColor("Color", ColorRGBA.Green); mat.getAdditionalRenderState().setDepthTest(false); skeletonDebug.setMaterial(mat); model.attachChild(skeletonDebug); rootNode.attachChild(model); }