Examples of SkeletonControl


Examples of com.jme3.animation.SkeletonControl

    }
  }
 
  protected void addSkeletons(){
    for(Node n : nodes){
      SkeletonControl con = n.getControl(SkeletonControl.class);
      if(con != null) {
            SkeletonDebugger skeletonDebug = new SkeletonDebugger("skeletondebug", con.getSkeleton());
            Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
            mat.getAdditionalRenderState().setWireframe(true);
            mat.setColor("Color", ColorRGBA.Red);
            mat.getAdditionalRenderState().setDepthTest(false);
            skeletonDebug.setMaterial(mat);
View Full Code Here

Examples of com.jme3.animation.SkeletonControl

    }
  }
 
  protected void addSkeletons(){
    for(Node n : nodes){
      SkeletonControl con = n.getControl(SkeletonControl.class);
      if(con != null) {
            SkeletonDebugger skeletonDebug = new SkeletonDebugger("skeletondebug", con.getSkeleton());
            skeletonDebug.setMaterial(matBones);
            n.attachChild(skeletonDebug);
      }
    }
  }
View Full Code Here

Examples of com.jme3.animation.SkeletonControl

          //TODO move this out into AnimationManger
      AnimControl c = new AnimControl(skel);//skeleton, animParts, template
      c.createChannel();
      c.setAnimationProvider(Singleton.get().getAnimManager().getAnimationProvider(animSet));
            model.addControl(new JMEAnimationController(c,animSet));
            SkeletonControl skeletonControl = new SkeletonControl(skel);
            model.addControl(skeletonControl);

            skeletonControl.setHardwareSkinningPreferred(useHWSkinning);

            BoundsUpdateControl bc = new BoundsUpdateControl();
            bc.setSkeleton(skel);
            model.addControl(bc);
            model.setShadowMode(ShadowMode.CastAndReceive);
View Full Code Here

Examples of com.jme3.animation.SkeletonControl

        model.setLocalRotation(Quaternion.IDENTITY);
        model.setLocalScale(1);
        //HACK ALERT change this
        //I remove the skeletonControl and readd it to the spatial to make sure it's after the ragdollControl in the stack
        //Find a proper way to order the controls.
        SkeletonControl sc = model.getControl(SkeletonControl.class);
        model.removeControl(sc);
        model.addControl(sc);

        // put into bind pose and compute bone transforms in model space
        // maybe dont reset to ragdoll out of animations?
View Full Code Here

Examples of com.jme3.animation.SkeletonControl

     *            the skeleton of the node
     * @param animationNames
     *            the names of the skeleton animations
     */
    public void applyAnimations(Node node, Skeleton skeleton, List<String> animationNames) {
        node.addControl(new SkeletonControl(skeleton));
        blenderContext.setNodeForSkeleton(skeleton, node);

        if (animationNames != null && animationNames.size() > 0) {
            List<Animation> animations = new ArrayList<Animation>();
            for (String animationName : animationNames) {
                BlenderAction action = actions.get(animationName);
                if (action != null) {
                    BoneTrack[] tracks = action.toTracks(skeleton);
                    if (tracks != null && tracks.length > 0) {
                        Animation boneAnimation = new Animation(animationName, action.getAnimationTime());
                        boneAnimation.setTracks(tracks);
                        animations.add(boneAnimation);
                        Long animatedNodeOMA = ((Number)blenderContext.getMarkerValue(ObjectHelper.OMA_MARKER, node)).longValue();
                        blenderContext.addAnimation(animatedNodeOMA, boneAnimation);
                    }
                } else {
                    LOGGER.log(Level.WARNING, "Cannot find animation named: {0}.", animationName);
                }
            }
            if (animations.size() > 0) {
                AnimControl control = new AnimControl(skeleton);
                HashMap<String, Animation> anims = new HashMap<String, Animation>(animations.size());
                for (int i = 0; i < animations.size(); ++i) {
                    Animation animation = animations.get(i);
                    anims.put(animation.getName(), animation);
                }
                control.setAnimations(anims);
                node.addControl(control);
               
                //make sure that SkeletonControl is added AFTER the AnimControl
                SkeletonControl skeletonControl = node.getControl(SkeletonControl.class);
                if(skeletonControl != null) {
                    node.removeControl(SkeletonControl.class);
                    node.addControl(skeletonControl);
                }
            }
View Full Code Here

Examples of com.jme3.animation.SkeletonControl

            AnimControl ctrl = new AnimControl(animData.skeleton);
            ctrl.setAnimations(anims);
            model.addControl(ctrl);

            // Put the skeleton in the skeleton control
            SkeletonControl skeletonControl = new SkeletonControl(animData.skeleton);

            // This will acquire the targets from the node
            model.addControl(skeletonControl);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.