当前位置: 首页>>代码示例>>Java>>正文


Java AnimChannel.setSpeed方法代码示例

本文整理汇总了Java中com.jme3.animation.AnimChannel.setSpeed方法的典型用法代码示例。如果您正苦于以下问题:Java AnimChannel.setSpeed方法的具体用法?Java AnimChannel.setSpeed怎么用?Java AnimChannel.setSpeed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.animation.AnimChannel的用法示例。


在下文中一共展示了AnimChannel.setSpeed方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import com.jme3.animation.AnimChannel; //导入方法依赖的package包/类
@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);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:19,代码来源:PauseAnimationAction.java

示例2: setPlay

import com.jme3.animation.AnimChannel; //导入方法依赖的package包/类
/**
 * Activate the defined animation in the AnimationComponent, on the main
 * channel (Currently only one channel is used).
 *
 * @param channel to use for the animation.
 * @param anim animation to play.
 */
private void setPlay(AnimChannel channel, Animation anim) {
    if (channel.getControl().getAnimationNames().contains(anim.name())) {
        switch (anim) {
            case IDLE:
                channel.setAnim(anim.toString(), 0.50f);
                channel.setLoopMode(LoopMode.Loop);
                channel.setSpeed(1f);
                break;
            case SUMMON:
                channel.setAnim(anim.toString());
                channel.setLoopMode(LoopMode.DontLoop);
                break;
            case WALK:
                channel.setAnim(anim.toString(), 0.50f);
                channel.setLoopMode(LoopMode.Loop);
                break;
            default:
                System.err.println(anim.name() + " Is not a supported animation type.");
        }
    } else if (anim.equals(Animation.SUMMON)) {
        setPlay(channel, Animation.IDLE);
    }
}
 
开发者ID:MultiverseKing,项目名称:MultiverseKing_JME,代码行数:31,代码来源:AnimationSystem.java

示例3: perform

import com.jme3.animation.AnimChannel; //导入方法依赖的package包/类
@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);
}
 
开发者ID:methusalah,项目名称:OpenRTS,代码行数:18,代码来源:AnimationPerformer.java

示例4: onAnimCycleDone

import com.jme3.animation.AnimChannel; //导入方法依赖的package包/类
/** 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);
  }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:10,代码来源:HelloAnimation.java

示例5: onAnimCycleDone

import com.jme3.animation.AnimChannel; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:8,代码来源:TestOgreAnim.java

示例6: onAnimCycleDone

import com.jme3.animation.AnimChannel; //导入方法依赖的package包/类
@Override
public void onAnimCycleDone(AnimControl control, AnimChannel channel,String animName) {
	if (animName.equals("jumo_1")) {
		channel.setAnim("idle_1");
		channel.setLoopMode(LoopMode.Loop);
		channel.setSpeed(0.3F);
	}
	if (animName.equals("atk_1")) {
		channel.setAnim("idle_1");
		channel.setLoopMode(LoopMode.Loop);
		channel.setSpeed(0.3F);
	}
	
	 
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:16,代码来源:TestRole.java

示例7: onAnimCycleDone

import com.jme3.animation.AnimChannel; //导入方法依赖的package包/类
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
    //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    // reset the character to a standing position after a Walk cycle is done.
    if (channel == attackChannel) channel.setAnim("stand");
    
    if (animName.equals("Walk") || animName.equals("Run") || animName.equals("Right") || animName.equals("Left")) {
        channel.setAnim("stand", 0.50f);
        channel.setLoopMode(LoopMode.DontLoop);
        channel.setSpeed(1f);
        
    }
}
 
开发者ID:devinbost,项目名称:jMathGame3d,代码行数:13,代码来源:HelloJME3.java

示例8: onAnimCycleDone

import com.jme3.animation.AnimChannel; //导入方法依赖的package包/类
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
    rotatePlayerRandomly();
    if (animName.equals("Dance")) {
        channel.setAnim("Idle", 0.50f);
        channel.setLoopMode(LoopMode.DontLoop);
        channel.setSpeed(1f);
    }
}
 
开发者ID:duodecimo,项目名称:jmcv,代码行数:9,代码来源:Main.java

示例9: simpleInitApp

import com.jme3.animation.AnimChannel; //导入方法依赖的package包/类
@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);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:55,代码来源:TestOgreComplexAnim.java

示例10: initialize

import com.jme3.animation.AnimChannel; //导入方法依赖的package包/类
@Override
public void initialize() {
    super.initialize();
    
    // -- 重置state
    shotState = 0;
    
    // 载入箭模型, 该箭模型(arrow)主要用于“取箭”及“拉弓上弦”动画。
    if (arrowNode == null && arrow != null) {
        arrowNode = Loader.loadModel(arrow);
        if (actor instanceof ModelEntity && ((ModelEntity) actor).isPreferUnshaded()) {
            GeometryUtils.makeUnshaded(arrowNode);
        }
    }
    
    // 偿试查找出弓模型,用于执行拉弓动画
    Spatial weapon = null;
    List<Skin> usingSkins = skinModule.getUsingSkins();
    if (usingSkins != null && !usingSkins.isEmpty()) {
        for (Skin skin : usingSkins) {
            if (skin instanceof WeaponSkin) {
                weapon = skin.getSpatial();
                break;
            }
        }
    }
  
    // -- 开始“弓”动画
    if (weapon != null && weaponAnim != null && trueUseTime > 0) {
        AnimControl ac = weapon.getControl(AnimControl.class);
        Animation anim = ac.getAnim(weaponAnim);
        if (anim == null) {
            return;
        }
        AnimChannel channel;
        if (ac.getNumChannels() > 0) {
            channel = ac.getChannel(0);
        } else {
            channel = ac.createChannel();
        }
        channel.setAnim(weaponAnim);
        channel.setLoopMode(LoopMode.DontLoop);
        channel.setSpeed(anim.getLength() / trueUseTime);
    }
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:46,代码来源:ShotBowSkill.java


注:本文中的com.jme3.animation.AnimChannel.setSpeed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。