Package com.ardor3d.extension.animation.skeletal

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


        assert scene != null : "scene must not be null.";

        // Check if we are a skinned mesh
        boolean doChildren = true;
        if (scene instanceof SkinnedMesh) {
            final SkeletonPose pose = ((SkinnedMesh) scene).getCurrentPose();
            if (pose != null && (allowSkeletonRedraw || !alreadyDrawn.contains(pose.getSkeleton()))) {
                // If we're in view, go ahead and draw our associated skeleton pose
                final Camera cam = Camera.getCurrentCamera();
                final int state = cam.getPlaneState();
                if (cam.contains(scene.getWorldBound()) != Camera.FrustumIntersect.Outside) {
                    SkeletalDebugger.drawSkeleton(pose, scene, renderer, showLabels);
                    alreadyDrawn.add(pose.getSkeleton());
                } else {
                    doChildren = false;
                }
                cam.setPlaneState(state);
            }
View Full Code Here


        time += timer.getTimePerFrame();
        if (time > UPDATE_RATE) {
            time -= UPDATE_RATE;
            final List<SkinData> skinDataList = colladaStorage.getSkins();
            final SkinData skinData = skinDataList.get(0);
            final SkeletonPose pose = skinData.getPose();

            final double time = timer.getTimeInSeconds();

            // Neck
            final Quaternion q = Quaternion.fetchTempInstance();
            final double vv = (time % (LOOP_TIME * 2d)) / LOOP_TIME - 1d;
            final double v = (vv > 0) ? vv : -vv;
            q.fromAngleAxis(v * 60 * MathUtils.DEG_TO_RAD - 30 * MathUtils.DEG_TO_RAD, Vector3.UNIT_Z);
            targetJoint(pose, 13, q);

            q.fromAngleAxis(v * 5 * MathUtils.DEG_TO_RAD - 35 * MathUtils.DEG_TO_RAD, Vector3.UNIT_X);
            q.fromAngleAxis(v * 75 * MathUtils.DEG_TO_RAD, Vector3.UNIT_X);

            Quaternion.releaseTempInstance(q);

            p.setLocation(Math.sin(time) * 5, Math.cos(time) * 5 + 10, 5);
            if (updateLight) {
                lightTime = time;
            }
            pp.setLocation(Math.sin(lightTime / 5) * 5, Math.cos(lightTime / 5) * 5 + 10, 5);

            pose.updateTransforms();

            if (UPDATE_BOUNDS) {
                final List<SkinnedMesh> skins = skinData.getSkins();
                for (final SkinnedMesh skinnedMesh : skins) {
                    skinnedMesh.updateModelBound();
View Full Code Here

        j2.setInverseBindPose(j2Transform);
        j2.setParentIndex((short) 0);

        final Skeleton sk = new Skeleton("arm sk", new Joint[] { j1, j2 });

        pose1 = new SkeletonPose(sk);
        pose1.updateTransforms();
        pose2 = new SkeletonPose(sk);
        pose2.updateTransforms();

        arm = new SkinnedMesh("arm");
        final Cylinder cy = new Cylinder("cylinder", 3, 8, 1, 10);
        arm.setBindPoseData(cy.getMeshData());
View Full Code Here

                });
    }

    private void addParticles(final SkinnedMesh mesh) {
        // find location of fist
        final SkeletonPose pose = mesh.getCurrentPose();
        final Transform loc = mesh.getWorldTransform().multiply(pose.getGlobalJointTransforms()[15], null);

        // Spawn a short lived explosion
        final ParticleSystem explosion = ParticleFactory.buildParticles("big", 80);
        explosion.setEmissionDirection(new Vector3(0.0f, 1.0f, 0.0f));
        explosion.setMaximumAngle(MathUtils.PI);
View Full Code Here

        time += timer.getTimePerFrame();
        if (time > ColladaManualAnimationExample.UPDATE_RATE) {
            time -= ColladaManualAnimationExample.UPDATE_RATE;
            final List<SkinData> skinDataList = colladaStorage.getSkins();
            final SkinData skinData = skinDataList.get(0);
            final SkeletonPose pose = skinData.getPose();

            final double time = timer.getTimeInSeconds();
            ballSphere.setTranslation(Math.sin(time) * 5, Math.cos(time) * 5 + 10, 5);
            final ReadOnlyVector3 ballPos = ballSphere.getTranslation();

            // Neck
            targetJoint(pose, 13, Vector3.UNIT_Z, ballPos, 1.0);

            // Right arm
            targetJoint(pose, 10, new Vector3(-1, 0, 0), ballPos, 0.4);
            targetJoint(pose, 11, new Vector3(-1, 0, 0), ballPos, 0.6);
            targetJoint(pose, 12, new Vector3(-1, 0, 0), ballPos, 0.5);

            // Left arm
            targetJoint(pose, 7, new Vector3(1, 0, 0), ballPos, 0.15);
            targetJoint(pose, 8, new Vector3(1, 0, 0), ballPos, 0.15);

            // Waist
            targetJoint(pose, 5, new Vector3(0, 1, 0), ballPos, 0.1);

            pose.updateTransforms();

            if (ColladaManualAnimationExample.UPDATE_BOUNDS) {
                final List<SkinnedMesh> skins = skinData.getSkins();
                for (final SkinnedMesh skinnedMesh : skins) {
                    skinnedMesh.updateModelBound();
View Full Code Here

                ourSkeleton = _dataCache.getJointSkeletonMapping().get(joint);
                order[i] = joint.getIndex();
            }

            // Make our skeleton pose
            SkeletonPose skPose = _dataCache.getSkeletonPoseMapping().get(ourSkeleton);
            if (skPose == null) {
                skPose = new SkeletonPose(ourSkeleton);
                _dataCache.getSkeletonPoseMapping().put(ourSkeleton, skPose);

                // attach any attachment points found for the skeleton's joints
                addAttachments(skPose);

                // Skeleton's default to bind position, so update the global transforms.
                skPose.updateTransforms();
            }

            // Read in our vertex_weights node
            final Element weightsEL = skin.getChild("vertex_weights");
            if (weightsEL == null) {
View Full Code Here

TOP

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

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.