Package com.ardor3d.extension.animation.skeletal.blendtree

Examples of com.ardor3d.extension.animation.skeletal.blendtree.ManagedTransformSource


        manager.getBaseAnimationLayer().setCurrentState("walk_anim", true);
        manager.findAnimationLayer("head").setCurrentState("head_rotate", true);

        // add a head rotator
        final int headJoint = pose.getSkeleton().findJointByName("Bip01_Head");
        final ManagedTransformSource headSource = (ManagedTransformSource) manager.findAnimationLayer("head")
                .getSteadyState("head_rotate").getSourceTree();
        _root.addController(new SpatialController<Node>() {
            private final Quaternion headRotation = new Quaternion();

            public void update(final double time, final Node caller) {
                // update the head's position
                if (headCheck != null && headCheck.isSelected()) {
                    double angle = _timer.getTimeInSeconds();
                    // range 0 to 180 degrees
                    angle %= MathUtils.PI;
                    // range -90 to 90 degrees
                    angle -= MathUtils.HALF_PI;
                    // range is now 0 to 90 degrees, reflected
                    angle = Math.abs(angle);
                    // range is now -45 to 45 degrees
                    angle -= MathUtils.HALF_PI / 2.0;

                    headRotation.fromAngleAxis(angle, Vector3.UNIT_X);
                    headSource.setJointRotation(headJoint, headRotation);
                }
            }
        });

        // add callback for our UI
View Full Code Here

TOP

Related Classes of com.ardor3d.extension.animation.skeletal.blendtree.ManagedTransformSource

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.