/** * Internal use only * * @see Track#setTime(float, float, com.jme3.animation.AnimControl, * com.jme3.animation.AnimChannel, com.jme3.util.TempVars) */ public void setTime(float time, float weight, AnimControl control, AnimChannel channel, TempVars vars) { if (time >= length) { return; } if (!initialized) { control.addListener(new OnEndListener()); initialized = true; } if (!started && time >= startOffset) { started = true; audio.playInstance(); } }
control.addListener(new OnEndListener()); initialized = true;
private void setupAnimationController() { animationControl = model.getControl(AnimControl.class); animationControl.addListener(this); animationChannel = animationControl.createChannel(); shootingChannel = animationControl.createChannel(); shootingChannel.addBone(animationControl.getSkeleton().getBone("uparm.right")); shootingChannel.addBone(animationControl.getSkeleton().getBone("arm.right")); shootingChannel.addBone(animationControl.getSkeleton().getBone("hand.right")); }
@Override public void simpleInitApp() { viewPort.setBackgroundColor(ColorRGBA.LightGray); initKeys(); /** Add a light source so we can see the model */ DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-0.1f, -1f, -1).normalizeLocal()); rootNode.addLight(dl); /** Load a model that contains animation */ player = (Node) assetManager.loadModel("Models/Oto/OtoOldAnim.j3o"); player.setLocalScale(0.5f); rootNode.attachChild(player); /** Create a controller and channels. */ control = player.getControl(AnimControl.class); control.addListener(this); channel = control.createChannel(); channel.setAnim("stand"); }
@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); Spatial model = (Spatial) assetManager.loadModel("Models/Oto/OtoOldAnim.j3o"); model.center(); control = model.getControl(AnimControl.class); control.addListener(this); channel = control.createChannel(); for (String anim : control.getAnimationNames()) System.out.println(anim); channel.setAnim("stand"); geom = (Geometry)((Node)model).getChild(0); SkeletonControl skeletonControl = model.getControl(SkeletonControl.class); Box b = new Box(.25f,3f,.25f); Geometry item = new Geometry("Item", b); item.move(0, 1.5f, 0); item.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); Node n = skeletonControl.getAttachmentsNode("hand.right"); n.attachChild(item); rootNode.attachChild(model); inputManager.addListener(this, "Attack"); inputManager.addMapping("Attack", new KeyTrigger(KeyInput.KEY_SPACE)); }
animChannel = control.createChannel(); animChannel.setAnim("IdleTop"); control.addListener(this);
@Override public void simpleInitApp() { flyCam.setMoveSpeed(10f); cam.setLocation(new Vector3f(6.4f, 7.5f, 12.8f)); 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(ColorRGBA.White); rootNode.addLight(dl); Spatial model = assetManager.loadModel("Models/Jaime/Jaime.j3o"); control = model.getControl(AnimControl.class); SkeletonControl skeletonControl = model.getControl(SkeletonControl.class); model.center(); model.setLocalScale(5f); control.addListener(this); channel = control.createChannel(); channel.setAnim("Idle"); Box box = new Box(0.3f, 0.02f, 0.02f); Geometry saber = new Geometry("saber", box); saber.move(0.4f, 0.05f, 0.01f); Material red = assetManager.loadMaterial("Common/Materials/RedColor.j3m"); saber.setMaterial(red); Node n = skeletonControl.getAttachmentsNode("hand.R"); n.attachChild(saber); rootNode.attachChild(model); inputManager.addListener(this, "Attack"); inputManager.addMapping("Attack", new KeyTrigger(KeyInput.KEY_SPACE)); }
control.addListener(this);
/** * Internal use only * * @see Track#setTime(float, float, com.jme3.animation.AnimControl, * com.jme3.animation.AnimChannel, com.jme3.util.TempVars) */ public void setTime(float time, float weight, AnimControl control, AnimChannel channel, TempVars vars) { if (time >= length) { return; } if (!initialized) { control.addListener(new OnEndListener()); initialized = true; } if (!started && time >= startOffset) { started = true; audio.playInstance(); } }
/** * Internal use only * * @see Track#setTime(float, float, com.jme3.animation.AnimControl, * com.jme3.animation.AnimChannel, com.jme3.util.TempVars) */ public void setTime(float time, float weight, AnimControl control, AnimChannel channel, TempVars vars) { if (time >= length) { return; } if (!initialized) { control.addListener(new OnEndListener()); initialized = true; } if (!started && time >= startOffset) { started = true; audio.playInstance(); } }
control.addListener(new OnEndListener()); initialized = true;
control.addListener(new OnEndListener()); initialized = true;
if (animControl != null) { animControl.setEnabled(false); animControl.addListener(new AnimEventListener() { if (animControl != null) { animControl.setEnabled(false); animControl.addListener(new AnimEventListener() { if (animControl != null) { animControl.setEnabled(false); animControl.addListener(new AnimEventListener() {
humanoidControl.addListener(this); return true;