Tabnine Logo
Skeleton
Code IndexAdd Tabnine to your IDE (free)

How to use
Skeleton
in
com.jme3.animation

Best Java code snippets using com.jme3.animation.Skeleton (Showing top 20 results out of 315)

origin: jMonkeyEngine/jmonkeyengine

public void setSkeleton(Skeleton skeleton) {
  if(bone != null)
    boneIndex = skeleton.getBoneIndex(bone);
}

origin: jMonkeyEngine/jmonkeyengine

/**
 * Remove any bones without vertices from the boneList, so that every hull
 * shape will contain at least 1 vertex.
 */
private void filterBoneList(SkeletonControl skeletonControl) {
  Mesh[] targets = skeletonControl.getTargets();
  Skeleton skel = skeletonControl.getSkeleton();
  for (int boneI = 0; boneI < skel.getBoneCount(); boneI++) {
    String boneName = skel.getBone(boneI).getName();
    if (boneList.contains(boneName)) {
      boolean hasVertices = RagdollUtils.hasVertices(boneI, targets,
          weightThreshold);
      if (!hasVertices) {
        boneList.remove(boneName);
      }
    }
  }
}
origin: jMonkeyEngine/jmonkeyengine

/**
 * Generate physics shapes and bone links for the skeleton.
 *
 * @param model the spatial with the model's SkeletonControl (not null)
 */
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);
      boneRecursion(model, childBone, baseRigidBody, 1, pointsMap);
    }
  }
}
origin: jMonkeyEngine/jmonkeyengine

/**
 * Add a single bone to be influenced by this animation channel.
 */
public void addBone(Bone bone) {
  int boneIndex = control.getSkeleton().getBoneIndex(bone);
  if(affectedBones == null) {
    affectedBones = new BitSet(control.getSkeleton().getBoneCount());
  }
  affectedBones.set(boneIndex);
}
origin: jMonkeyEngine/jmonkeyengine

private Bone recreateBoneStructure(Bone sourceRoot) {
  Bone targetRoot = getBone(sourceRoot.getName());
  List<Bone> children = sourceRoot.getChildren();
  for (int i = 0; i < children.size(); i++) {
    Bone sourceChild = children.get(i);
    // find my version of the child
    Bone targetChild = getBone(sourceChild.getName());
    targetRoot.addChild(targetChild);
    recreateBoneStructure(sourceChild);
  }
  return targetRoot;
}
origin: jMonkeyEngine/jmonkeyengine

/**
 * Internal use only.
 */
@Override
protected void controlUpdate(float tpf) {
  if (skeleton != null) {
    skeleton.reset(); // reset skeleton to bind pose
  }
  TempVars vars = TempVars.get();
  for (int i = 0; i < channels.size(); i++) {
    channels.get(i).update(tpf, vars);
  }
  vars.release();
  if (skeleton != null) {
    skeleton.updateWorldVectors();
  }
}
origin: jMonkeyEngine/jmonkeyengine

  float time = ((BoneTrack) track).getTimes()[frame];
  track.setTime(time, 1, animControl, animChannel, vars);
  skeleton.updateWorldVectors();
for (Bone rootBone : skeleton.getRoots()) {
  if (skeleton.getBoneIndex(rootBone) > 0) {
    this.applyConstraints(rootBone, alteredOmas, applied, frame, new Stack<Bone>());
  int boneIndex = skeleton.getBoneIndex(boneContext.getBone());
  if (!tracks.containsKey(boneIndex)) {
    tracks.put(boneIndex, new VirtualTrack(boneContext.getBone().getName(), maxFrame, maxTime));
  Bone bone = skeleton.getBone(trackEntry.getKey());
  Transform startTransform = boneStartTransforms.get(bone);
origin: jMonkeyEngine/jmonkeyengine

Joint[] joints = new Joint[skeleton.getBoneCount()];
for (int i = 0; i < skeleton.getBoneCount(); i++) {
  Bone b = skeleton.getBone(i);
  Joint j = joints[i];
  if (j == null) {
    int index = skeleton.getBoneIndex(bone);
    Joint joint = joints[index];
    if (joint == null) {
      BoneTrack boneTrack = (BoneTrack) track;
      int index = boneTrack.getTargetBoneIndex();
      Bone bone = skeleton.getBone(index);
      Joint joint = joints[index];
      TransformTrack jointTrack = fromBoneTrack(boneTrack, bone, joint);
origin: info.projectkyoto/mms-engine

PMDNode newPMDNode = (PMDNode)super.clone();
newPMDNode.skeleton = new Skeleton(skeleton);
for(int i=0;i<skeleton.getBoneCount();i++) {
  Bone newBone = newPMDNode.skeleton.getBone(i);
  Bone bone = skeleton.getBone(i);
  newBone.getLocalPosition().set(bone.getLocalPosition());
  newBone.getLocalRotation().set(bone.getLocalRotation());
newPMDNode.skeleton.updateWorldVectors();
newPMDNode.offsetMatrixbuffer = null;
newPMDNode.calcOffsetMatrices();
origin: jMonkeyEngine/jmonkeyengine

/**
 * Converts the action into JME bone animation tracks.
 * 
 * @param skeleton
 *            the skeleton that will be animated
 * @return the bone tracks for the node
 */
public BoneTrack[] toTracks(Skeleton skeleton, BlenderContext blenderContext) {
  List<BoneTrack> tracks = new ArrayList<BoneTrack>(featuresTracks.size());
  for (Entry<String, Ipo> entry : featuresTracks.entrySet()) {
    int boneIndex = skeleton.getBoneIndex(entry.getKey());
    BoneContext boneContext = blenderContext.getBoneContext(skeleton.getBone(boneIndex));
    tracks.add((BoneTrack) entry.getValue().calculateTrack(boneIndex, boneContext, boneContext.getBone().getBindPosition(), boneContext.getBone().getBindRotation(), boneContext.getBone().getBindScale(), 1, stopFrame, fps, false));
  }
  return tracks.toArray(new BoneTrack[tracks.size()]);
}
origin: org.jmonkeyengine/jme3-dae

bone.setBindTransforms(new Vector3f(0, 0, 0), new Quaternion(Quaternion.IDENTITY), new Vector3f(Vector3f.UNIT_XYZ));
Skeleton skeleton = new Skeleton(new Bone[] {bone});
skeleton.setBindingPose();
skeleton.updateWorldVectors();
skeleton.resetAndUpdate();
skeleton.computeSkinningMatrices();
origin: jMonkeyEngine/jmonkeyengine

/**
 * Access the named bone.
 *
 * @param name which bone to access
 * @return the pre-existing instance, or null if not found
 */
public Bone getBone(String name){
  return skeleton.getBone(name);
}
/**
origin: jMonkeyEngine/jmonkeyengine

/**
 * Ensure that user control is enabled for any bones used by inverse
 * kinematics and disabled for any other bones.
 */
public void applyUserControl() {
  for (Bone bone : skeleton.getRoots()) {
    RagdollUtils.setUserControl(bone, false);
  }
  if (ikTargets.isEmpty()) {
    setKinematicMode();
  } else {
    Iterator iterator = ikTargets.keySet().iterator();
    TempVars vars = TempVars.get();
    while (iterator.hasNext()) {
      Bone bone = (Bone) iterator.next();
      while (bone.getParent() != null) {
        Quaternion tmpRot1 = vars.quat1;
        Vector3f position = vars.vect1;
        matchPhysicObjectToBone(boneLinks.get(bone.getName()), position, tmpRot1);
        bone.setUserControl(true);
        bone = bone.getParent();
      }
    }
    vars.release();
  }
}
origin: org.jmonkeyengine/jme3-core

/**
 * Creates a debugger with no length data. The wires will be a connection
 * between the bones' heads only. The points will show the bones' heads only
 * and no dotted line of inter bones connection will be visible.
 *
 * @param name     the name of the debugger's node
 * @param skeleton the skeleton that will be shown
 */
public SkeletonDebugger(String name, Skeleton skeleton, boolean guessBonesOrientation) {
  super(name);
  this.skeleton = skeleton;
  skeleton.reset();
  skeleton.updateWorldVectors();
  Map<Integer, Float> boneLengths = new HashMap<Integer, Float>();
  for (Bone bone : skeleton.getRoots()) {
    computeLength(bone, boneLengths, skeleton);
  }
  bones = new SkeletonBone(skeleton, boneLengths, guessBonesOrientation);
  this.attachChild(bones);
  interBoneWires = new SkeletonInterBoneWire(skeleton, boneLengths, guessBonesOrientation);
  Geometry g = new Geometry(name + "_interwires", interBoneWires);
  g.setBatchHint(BatchHint.Never);
  this.attachChild(g);
}
origin: info.projectkyoto/mms-engine

protected void resetBonePos() {
  for (int i = 0; i < pmdNode.getSkeleton().getBoneCount(); i++) {
    Bone bone = pmdNode.getSkeleton().getBone(i);
    bone.setUserControl(false);
  }
  pmdNode.getSkeleton().resetAndUpdate();
  for (int i = 0; i < pmdNode.getSkeleton().getBoneCount(); i++) {
    Bone bone = pmdNode.getSkeleton().getBone(i);
    bone.setUserControl(true);
  }
}
origin: info.projectkyoto/mms-engine

void calcBonePosition() {
  for (int i = pmdNode.getSkeleton().getBoneCount() - 1; i >= 0; i--) {
    int i2 = i; //boneEnabled.length -1 - i;
    if (boneEnabled[i2] == 1) {
      Bone bone = pmdNode.getSkeleton().getBone(i);
      bone.getLocalRotation().loadIdentity();
  pmdNode.getSkeleton().updateWorldVectors();
  ikControl.updateIKBoneRotation();
  for (int i = 0; i < pmdNode.getPmdModel().getBoneList().getBoneCount(); i++) {
    if (pmdBone.getBoneType() == 5 && boneEnabled[i] == 1) {
      Bone bone = pmdNode.getSkeleton().getBone(i);
      Bone targetBone = pmdNode.getSkeleton().getBone(pmdBone.getTargetBone());
      bone.getLocalRotation().multLocal(targetBone.getLocalRotation());
      bone.updateWorldVectors();
origin: jMonkeyEngine/jmonkeyengine

this.skeleton = skeleton;
for (Bone bone : skeleton.getRoots()) {
  this.countConnections(bone);
int lineVerticesCount = skeleton.getBoneCount();
if (boneLengths != null) {
  this.boneLengths = boneLengths;
  for (Bone bone : skeleton.getRoots()) {
    this.writeConnections(sib, bone);
origin: jMonkeyEngine/jmonkeyengine

public static Skeleton createSkeleton(FbxNode skeletonHolderNode) {
  if (skeletonHolderNode instanceof FbxLimbNode) {
    throw new UnsupportedOperationException("Limb nodes cannot be skeleton holders");
  }
  
  List<Bone> bones = new ArrayList<Bone>();
  
  for (FbxNode child : skeletonHolderNode.getChildren()) {
    if (child instanceof FbxLimbNode) {
      createBones(skeletonHolderNode, (FbxLimbNode) child, bones);
    }
  }
  
  return new Skeleton(bones.toArray(new Bone[0]));
}

origin: org.jmonkeyengine/jme3-plugins

Skeleton skeleton = new Skeleton(bones);
for (Bone bone : skeleton.getRoots()) {
  BoneWrapper bw = findBoneWrapper(bone);
  computeBindTransforms(bw, skeleton);
  applyPose(joints.get(i).getAsInt());
skeleton.updateWorldVectors();
origin: jMonkeyEngine/jmonkeyengine

final void reset() {
  if (skeleton != null) {
    skeleton.resetAndUpdate();
  }
}
com.jme3.animationSkeleton

Javadoc

Skeleton is a convenience class for managing a bone hierarchy. Skeleton updates the world transforms to reflect the current local animated matrixes.

Most used methods

  • getBoneIndex
    returns the bone index of the bone that has the given name
  • getBone
    returns the bone with the given name
  • getRoots
    returns the array of all root bones of this skeleton
  • resetAndUpdate
    Reset the skeleton to bind pose and updates the bones
  • <init>
    Creates a skeleton from a bone list. The root bones are found automatically. Note that using this c
  • getBoneCount
    returns the number of bones of this skeleton
  • updateWorldVectors
    Updates world transforms for all bones in this skeleton. Typically called after setting local animat
  • computeSkinningMatrices
    Compute the skining matrices for each bone of the skeleton that would be used to transform vertices
  • reset
    Reset the skeleton to bind pose.
  • setBindingPose
    Saves the current skeleton state as its binding pose.
  • createSkinningMatrices
  • recreateBoneStructure
  • createSkinningMatrices,
  • recreateBoneStructure

Popular in Java

  • Reactive rest calls using spring rest template
  • runOnUiThread (Activity)
  • setContentView (Activity)
  • getSystemService (Context)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • JOptionPane (javax.swing)
  • Runner (org.openjdk.jmh.runner)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now