Package com.jme3.animation

Examples of com.jme3.animation.AnimControl


    private Spatial model;

    public AnimComponent(Spatial model) {
        this.model = model;
        if (model != null) {
            AnimControl control = model.getControl(AnimControl.class);
            this.animControl = control;
            GameNameGoesHere app = GameNameGoesHere.getApp();
            control.addListener(app.getAnimManager());
            createChannels();

            animControl.getChannel(AnimConf.UPPER_BODY).setAnim("Walk");

            // animControl.getChannel(AnimConf.UPPER_BODY).setAnim("Idle"); //need init animation
View Full Code Here


      if(n != null){
        rootNode.attachChild(n);
//        n.updateGeometricState();
     

        final AnimControl conn = n.getControl(AnimControl.class);
        SwingUtilities.invokeLater(new Runnable() {

          public void run() {
            final JDesktopPane desktopPane = jmeDesktop.getJDesktop();
            final JInternalFrame internalFrame = new JInternalFrame();
View Full Code Here

//        baseNode.updateModelBound();
//        baseNode.updateGeometricState();
        vis = baseNode.clone(false);
        vis.setName(name);
       
        AnimControl animControl = vis.getControl(AnimControl.class);
        AnimChannel chan;
        if(animControl != null) {
         
          if (animControl.getNumChannels()<=0){
            animControl.createChannel();
          }
          chan = animControl.getChannel(0);
            chan.setAnim("idle");
            chan.setTime(animControl.getAnimationLength("idle")
            * FastMath.nextRandomFloat());
         
        } else {
          logger.severe("Vis animations are missing for troll");
        }
View Full Code Here

              fixHWModels(model);
            }
           
            Skeleton skel = new Skeleton(skeleton);
          //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);
View Full Code Here

        /** You must add a light to make the model visible */
        DirectionalLight sun = new DirectionalLight();
        sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f).normalizeLocal());
        rootNode.addLight(sun);
       
      AnimControl c = (AnimControl)rootNode.getChild(0).getControl(0);
      c.createChannel();
      final JMESimpleController con = new JMESimpleController(c);
      rootNode.getChild(0).addControl(con);

      if(con!= null ){
        SwingUtilities.invokeLater(new Runnable() {
View Full Code Here

    public void addBoneName(String name) {
        boneList.add(name);
    }

    protected void scanSpatial(Spatial model) {
        AnimControl animControl = model.getControl(AnimControl.class);
        Map<Integer, List<Float>> pointsMap = null;
        if (weightThreshold == -1.0f) {
            pointsMap = RagdollUtils.buildPointMap(model);
        }

        skeleton = animControl.getSkeleton();
        skeleton.resetAndUpdate();
        for (int i = 0; i < skeleton.getRoots().length; i++) {
            Bone childBone = skeleton.getRoots()[i];
            if (childBone.getParent() == null) {
                logger.log(Level.FINE, "Found root bone in skeleton {0}", skeleton);
View Full Code Here

     *
     * @param ragdollEnabled
     */
    protected void setMode(Mode mode) {
        this.mode = mode;
        AnimControl animControl = targetModel.getControl(AnimControl.class);
        animControl.setEnabled(mode == Mode.Kinematic);

        baseRigidBody.setKinematic(mode == Mode.Kinematic);
        TempVars vars = TempVars.get();

        for (PhysicsBoneLink link : boneLinks.values()) {
View Full Code Here

            return;
        }
        blendedControl = true;
        this.blendTime = blendTime;
        mode = Mode.Kinematic;
        AnimControl animControl = targetModel.getControl(AnimControl.class);
        animControl.setEnabled(true);


        TempVars vars = TempVars.get();
        for (PhysicsBoneLink link : boneLinks.values()) {
View Full Code Here

                    LOGGER.log(Level.WARNING, "Cannot find animation named: {0}.", animationName);
                }
            }

            if (animations.size() > 0) {
                AnimControl control = new AnimControl();
                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);
            }
        }
    }
View Full Code Here

                } 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) {
View Full Code Here

TOP

Related Classes of com.jme3.animation.AnimControl

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.