Home | History | Annotate | Download | only in ragdoll
      1 /*
      2  * To change this template, choose Tools | Templates
      3  * and open the template in the editor.
      4  */
      5 package com.jme3.bullet.control.ragdoll;
      6 
      7 import com.jme3.math.FastMath;
      8 
      9 /**
     10  *
     11  * @author Nehon
     12  */
     13 public class HumanoidRagdollPreset extends RagdollPreset {
     14 
     15     @Override
     16     protected void initBoneMap() {
     17         boneMap.put("head", new JointPreset(FastMath.QUARTER_PI, -FastMath.QUARTER_PI, FastMath.QUARTER_PI, -FastMath.QUARTER_PI, FastMath.QUARTER_PI, -FastMath.QUARTER_PI));
     18 
     19         boneMap.put("torso", new JointPreset(FastMath.QUARTER_PI, -FastMath.QUARTER_PI, 0, 0, FastMath.QUARTER_PI, -FastMath.QUARTER_PI));
     20 
     21         boneMap.put("upperleg", new JointPreset(FastMath.PI, -FastMath.QUARTER_PI, FastMath.QUARTER_PI/2, -FastMath.QUARTER_PI/2, FastMath.QUARTER_PI, -FastMath.QUARTER_PI));
     22 
     23         boneMap.put("lowerleg", new JointPreset(0, -FastMath.PI, 0, 0, 0, 0));
     24 
     25         boneMap.put("foot", new JointPreset(0, -FastMath.QUARTER_PI, FastMath.QUARTER_PI, -FastMath.QUARTER_PI, FastMath.QUARTER_PI, -FastMath.QUARTER_PI));
     26 
     27         boneMap.put("upperarm", new JointPreset(FastMath.HALF_PI, -FastMath.QUARTER_PI, 0, 0, FastMath.HALF_PI, -FastMath.QUARTER_PI));
     28 
     29         boneMap.put("lowerarm", new JointPreset(FastMath.HALF_PI, 0, 0, 0, 0, 0));
     30 
     31         boneMap.put("hand", new JointPreset(FastMath.QUARTER_PI, -FastMath.QUARTER_PI, FastMath.QUARTER_PI, -FastMath.QUARTER_PI, FastMath.QUARTER_PI, -FastMath.QUARTER_PI));
     32 
     33     }
     34 
     35     @Override
     36     protected void initLexicon() {
     37         LexiconEntry entry = new LexiconEntry();
     38         entry.addSynonym("head", 100);
     39         lexicon.put("head", entry);
     40 
     41         entry = new LexiconEntry();
     42         entry.addSynonym("torso", 100);
     43         entry.addSynonym("chest", 100);
     44         entry.addSynonym("spine", 45);
     45         entry.addSynonym("high", 25);
     46         lexicon.put("torso", entry);
     47 
     48         entry = new LexiconEntry();
     49         entry.addSynonym("upperleg", 100);
     50         entry.addSynonym("thigh", 100);
     51         entry.addSynonym("hip", 75);
     52         entry.addSynonym("leg", 40);
     53         entry.addSynonym("high", 10);
     54         entry.addSynonym("up", 15);
     55         entry.addSynonym("upper", 15);
     56         lexicon.put("upperleg", entry);
     57 
     58         entry = new LexiconEntry();
     59         entry.addSynonym("lowerleg", 100);
     60         entry.addSynonym("calf", 100);
     61         entry.addSynonym("knee", 75);
     62         entry.addSynonym("leg", 50);
     63         entry.addSynonym("low", 10);
     64         entry.addSynonym("lower", 10);
     65         lexicon.put("lowerleg", entry);
     66 
     67         entry = new LexiconEntry();
     68         entry.addSynonym("foot", 100);
     69         entry.addSynonym("ankle", 75);
     70         lexicon.put("foot", entry);
     71 
     72 
     73         entry = new LexiconEntry();
     74         entry.addSynonym("upperarm", 100);
     75         entry.addSynonym("humerus", 100);
     76         entry.addSynonym("shoulder", 50);
     77         entry.addSynonym("arm", 40);
     78         entry.addSynonym("high", 10);
     79         entry.addSynonym("up", 15);
     80         entry.addSynonym("upper", 15);
     81         lexicon.put("upperarm", entry);
     82 
     83         entry = new LexiconEntry();
     84         entry.addSynonym("lowerarm", 100);
     85         entry.addSynonym("ulna", 100);
     86         entry.addSynonym("elbow", 75);
     87         entry.addSynonym("arm", 50);
     88         entry.addSynonym("low", 10);
     89         entry.addSynonym("lower", 10);
     90         lexicon.put("lowerarm", entry);
     91 
     92         entry = new LexiconEntry();
     93         entry.addSynonym("hand", 100);
     94         entry.addSynonym("fist", 100);
     95         entry.addSynonym("wrist", 75);
     96         lexicon.put("hand", entry);
     97 
     98     }
     99 }
    100