Package com.jme3.animation

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


    }
  }
 
  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

          //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

        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

     *            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

            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

  public static void startApp(){
    app.startCanvas();
    app.enqueue(new Callable<Void>(){
      public Void call(){
        if (app instanceof SimpleApplication){
          SimpleApplication simpleApp = (SimpleApplication) app;
          simpleApp.getFlyByCamera().setDragToRotate(true);
          String assdir =  new File(workspace).getAbsolutePath();
          app.setAssetsPath(assdir);
        }
        return null;
      }
View Full Code Here

     * Attaches Statistics View to guiNode and displays it on the screen
     * above FPS statistics line.
     *
     */
    public void loadStatsView() {
        statsView = new StatsView("Statistics View", assetManager, renderer.getStatistics());
//         move it up so it appears above fps text
        statsView.setLocalTranslation(0, fpsText.getLineHeight(), 0);
        guiNode.attachChild(statsView);
    }
View Full Code Here

        listener = new Listener();
        ar.setListener(listener);
       
        // init StateManager ----------------------------
        stateManager = new AppStateManager(this);
       
        // simple Init ----------------------------------
        guiNode.setQueueBucket(Bucket.Gui);
        guiNode.setCullHint(CullHint.Never);
        //loadFPSText();
View Full Code Here

    private void setColor(Node node, ColorRGBA color){
  for(int i = 0; i < node.getQuantity(); i++){
      Spatial spatial = node.getChild(i);
      if(spatial instanceof Geometry){
                //Material material = new Material();
                AssetManager assetManager = JmeSystem.newAssetManager(Thread.currentThread().getContextClassLoader().getResource("com/jme3/asset/Desktop.cfg"));
                Material material = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
                material.setColor("m_Color",color);
                //Material geomMaterial = ((Geometry)spatial).getMaterial();
                spatial.setMaterial(material);
                System.out.println("Spatial: "+spatial.getName());
View Full Code Here

TOP

Related Classes of com.jme3.animation.SkeletonControl

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.