com.jme3.animation.AnimChannel Java Examples
The following examples show how to use
com.jme3.animation.AnimChannel.
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: AnimationTrack.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void initEvent(Application app, Cinematic cinematic) { super.initEvent(app, cinematic); if (channel == null) { Object s = cinematic.getEventData("modelChannels", modelName); if (s != null && s instanceof AnimChannel) { this.channel = (AnimChannel) s; } else if (s == null) { Spatial model = cinematic.getScene().getChild(modelName); if (model != null) { channel = model.getControl(AnimControl.class).createChannel(); cinematic.putEventData("modelChannels", modelName, channel); } else { log.log(Level.WARNING, "spatial {0} not found in the scene, cannot perform animation", modelName); } } } }
Example #3
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 #4
Source File: StopAnimationAction.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.setLoopMode(LoopMode.DontLoop); EXECUTOR_MANAGER.addJmeTask(control::clearChannels); final NodeTree<ModelChangeConsumer> nodeTree = getNodeTree(); nodeTree.update(modelNode); }
Example #5
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 #6
Source File: TestOgreConvert.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void simpleInitApp() { Spatial ogreModel = assetManager.loadModel("Models/Oto/Oto.mesh.xml"); DirectionalLight dl = new DirectionalLight(); dl.setColor(ColorRGBA.White); dl.setDirection(new Vector3f(0,-1,-1).normalizeLocal()); rootNode.addLight(dl); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryExporter exp = new BinaryExporter(); exp.save(ogreModel, baos); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); BinaryImporter imp = new BinaryImporter(); imp.setAssetManager(assetManager); Node ogreModelReloaded = (Node) imp.load(bais, null, null); AnimControl control = ogreModelReloaded.getControl(AnimControl.class); AnimChannel chan = control.createChannel(); chan.setAnim("Walk"); rootNode.attachChild(ogreModelReloaded); } catch (IOException ex){ ex.printStackTrace(); } }
Example #7
Source File: TestBoneRagdoll.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
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"); // } }
Example #8
Source File: TestRagdollCharacter.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
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); } }
Example #9
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 #10
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 #11
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 #12
Source File: ActorDrawer.java From OpenRTS with MIT License | 4 votes |
@Override public void onAnimChange(AnimControl control, AnimChannel channel, String animName) { // LogUtil.logger.info("anim changed to "+animName); }
Example #13
Source File: HelloAnimation.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
/** Use this listener to trigger something between two animations. */ public void onAnimChange(AnimControl control, AnimChannel channel, String animName) { // unused }
Example #14
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); }
Example #15
Source File: TestAttachmentsNode.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void onAnimChange(AnimControl control, AnimChannel channel, String animName) { }
Example #16
Source File: TestOgreAnim.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
public void onAnimChange(AnimControl control, AnimChannel channel, String animName) { }
Example #17
Source File: ActorDrawer.java From OpenRTS with MIT License | 4 votes |
@Override public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { }
Example #18
Source File: TestRagdollCharacter.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
public void onAnimChange(AnimControl control, AnimChannel channel, String animName) { }
Example #19
Source File: TestWalkingChar.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { if (channel == shootingChannel) { channel.setAnim("stand"); } }
Example #20
Source File: TestWalkingChar.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
public void onAnimChange(AnimControl control, AnimChannel channel, String animName) { }
Example #21
Source File: TestBoneRagdoll.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
public void onAnimChange(AnimControl control, AnimChannel channel, String animName) { }
Example #22
Source File: HelloAnimation.java From chuidiang-ejemplos with GNU Lesser General Public License v3.0 | 4 votes |
public void onAnimChange(AnimControl control, AnimChannel channel, String animName) { // unused }