本文整理汇总了Java中com.jme3.animation.AnimChannel.setLoopMode方法的典型用法代码示例。如果您正苦于以下问题:Java AnimChannel.setLoopMode方法的具体用法?Java AnimChannel.setLoopMode怎么用?Java AnimChannel.setLoopMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.animation.AnimChannel
的用法示例。
在下文中一共展示了AnimChannel.setLoopMode方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.setLoopMode(LoopMode.DontLoop);
EXECUTOR_MANAGER.addJMETask(control::clearChannels);
final NodeTree<ModelChangeConsumer> nodeTree = getNodeTree();
nodeTree.update(modelNode);
}
示例2: animate
import com.jme3.animation.AnimChannel; //导入方法依赖的package包/类
protected void animate(AnimationSource source, Entity e) {
Spatial spatial = RendererPlatform.getMainSceneNode().getChild(source.getMesh());
if (spatial == null) {
System.err.println("spatial [" + source.getMesh() + "] not found");
return;
}
AnimControl playerControl = spatial.getControl(AnimControl.class);
AnimChannel channel = SpatialPool.getPlayinganimations().get(e.getId());
if (channel == null) {
channel = playerControl.createChannel();
SpatialPool.getPlayinganimations().put(e.getId(), channel);
}
channel.setAnim(source.getAnimName(), (float) source.getSpeed());
channel.setLoopMode(source.getLoopMode());
}
示例3: 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);
}
}
示例4: 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);
}
示例5: 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);
}
}
示例6: 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);
}
}
示例7: onAnimCycleDone
import com.jme3.animation.AnimChannel; //导入方法依赖的package包/类
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");
// }
}
示例8: 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);
}
}
示例9: stop
import com.jme3.animation.AnimChannel; //导入方法依赖的package包/类
protected void stop(Entity e) {
AnimChannel channel = SpatialPool.getPlayinganimations().get(e.getId());
if (channel != null) {
channel.setLoopMode(LoopMode.DontLoop);
}
}
示例10: 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);
}
}
示例11: 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);
}
}
示例12: onAnimCycleDone
import com.jme3.animation.AnimChannel; //导入方法依赖的package包/类
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);
}
}
示例13: 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);
}
示例14: 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);
}
}