Package com.ardor3d.extension.animation.skeletal

Examples of com.ardor3d.extension.animation.skeletal.AnimationManager


    private void createAnimation() {
        final ColladaImporter colladaImporter = new ColladaImporter();

        // Make our manager
        manager = new AnimationManager(_timer, pose);

        // Add our "applier logic".
        final SimpleAnimationApplier applier = new SimpleAnimationApplier();
        manager.setApplier(applier);
View Full Code Here


    private void createAnimation() {
        final ColladaImporter colladaImporter = new ColladaImporter();

        // Make our manager
        manager = new AnimationManager(_timer, pose);

        // Add our "applier logic".
        final SimpleAnimationApplier applier = new SimpleAnimationApplier();
        manager.setApplier(applier);
View Full Code Here

        for (int i = 0; i < 10; i++) {
            final SkinnedMesh copy = skeleton.makeCopy(true);
            copy.setCurrentPose(skeleton.getCurrentPose().makeCopy());
            copy.setTranslation(((i % 5) - 2) * 60, 0, ((i / 5) * 40) - 320);
            _root.attachChild(copy);
            final AnimationManager manager = createAnimationManager(copy.getCurrentPose());
            managers.add(manager);
            animInfo.add(new AnimationInfo());
            poseToMesh.put(copy.getCurrentPose(), copy);
        }
    }
View Full Code Here

    private final Map<String, AnimationClip> animationStore = Maps.newHashMap();

    private AnimationManager createAnimationManager(final SkeletonPose pose) {
        // Make our manager
        final AnimationManager manager = new AnimationManager(_timer, pose);

        // Add our "applier logic".
        final SimpleAnimationApplier applier = new SimpleAnimationApplier();
        manager.setApplier(applier);

        // Add a call back to load clips.
        final InputStore input = new InputStore();
        input.getClips().setMissCallback(new MissingCallback<String, AnimationClip>() {
            public AnimationClip getValue(final String key) {
                if (!animationStore.containsKey(key)) {
                    try {
                        final ColladaStorage storage1 = new ColladaImporter().load("collada/skeleton/" + key + ".dae");
                        animationStore.put(key, storage1.extractChannelsAsClip(key));
                    } catch (final IOException e) {
                        e.printStackTrace();
                        animationStore.put(key, null);
                    }
                }
                return animationStore.get(key);
            }
        });

        // Load our layer and states from script
        try {
            final ResourceSource layersFile = new URLResourceSource(ResourceLocatorTool.getClassPathResource(
                    AnimationDemoExample.class, "com/ardor3d/example/pipeline/AnimationDemoExample.js"));
            JSLayerImporter.addLayers(layersFile, manager, input);
        } catch (final Exception e) {
            e.printStackTrace();
        }

        // kick things off by setting our starting state
        manager.getBaseAnimationLayer().setCurrentState("walk_anim", true);

        return manager;
    }
View Full Code Here

    }

    @Override
    protected void updateExample(final ReadOnlyTimer timer) {
        for (int i = 0, max = managers.size(); i < max; i++) {
            final AnimationManager manager = managers.get(i);
            final AnimationInfo info = animInfo.get(i);
            if (System.currentTimeMillis() - info.lastStateChange > MIN_STATE_TIME) {
                if (Math.random() < 0.001) {
                    manager.getBaseAnimationLayer().doTransition(info.running ? "walk" : "run");
                    info.running = !info.running;
                    info.lastStateChange = System.currentTimeMillis();
                    manager.findAnimationLayer("punch").setCurrentState("punch_right", true);
                }
            }
            manager.update();
        }
    }
View Full Code Here

        if (storage.getAnimationChannels().isEmpty() || storage.getSkins().isEmpty()) {
            return;
        }

        // Make our manager
        manager = new AnimationManager(_timer, skinDatas.get(0).getPose());

        final AnimationClip clipA = storage.extractChannelsAsClip("clipA");

        // Set some clip instance specific data - repeat, time scaling
        manager.getClipInstance(clipA).setLoopCount(Integer.MAX_VALUE);
View Full Code Here

TOP

Related Classes of com.ardor3d.extension.animation.skeletal.AnimationManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.