Codota Logo
Joint
Code IndexAdd Codota to your IDE (free)

How to use
Joint
in
com.jme3.anim

Best Java code snippets using com.jme3.anim.Joint (Showing top 19 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
origin: jMonkeyEngine/jmonkeyengine

private static Joint fromBone(Bone b) {
  Joint j = new Joint(b.getName());
  j.setLocalTranslation(b.getBindPosition());
  j.setLocalRotation(b.getBindRotation());
  j.setLocalScale(b.getBindScale());
  return j;
}
origin: jMonkeyEngine/jmonkeyengine

public static void padJointTracks(List<TransformTrack> tracks, Joint staticJoint) {
  Joint j = staticJoint;
  if (j != null) {
    // joint has no track , we create one with the default pose
    float[] times = new float[]{0};
    Vector3f[] translations = new Vector3f[]{j.getLocalTranslation()};
    Quaternion[] rotations = new Quaternion[]{j.getLocalRotation()};
    Vector3f[] scales = new Vector3f[]{j.getLocalScale()};
    TransformTrack track = new TransformTrack(j, times, translations, rotations, scales);
    tracks.add(track);
  }
}
origin: jMonkeyEngine/jmonkeyengine

/**
 * returns the joint index of the joint that has the given name
 *
 * @param name
 * @return
 */
public int getJointIndex(String name) {
  for (int i = 0; i < jointList.length; i++) {
    if (jointList[i].getName().equals(name)) {
      return i;
    }
  }
  return -1;
}
origin: jMonkeyEngine/jmonkeyengine

/**
 * Sets the local transform with the initial transform
 */
protected void applyInitialPose() {
  setLocalTransform(initialTransform);
  updateModelTransforms();
  for (Joint child : children.getArray()) {
    child.applyInitialPose();
  }
}
origin: jMonkeyEngine/jmonkeyengine

/**
 * Sets the local transform with the bind transforms
 */
protected void applyBindPose() {
  jointModelTransform.applyBindPose(localTransform, inverseModelBindMatrix, parent);
  updateModelTransforms();
  for (Joint child : children.getArray()) {
    child.applyBindPose();
  }
}
origin: jMonkeyEngine/jmonkeyengine

selectedBones.put(ad.getArmature(), selectedjoint);
System.err.println("-----------------------");
System.err.println("Selected Joint : " + selectedjoint.getName() + " in armature " + ad.getName());
System.err.println("Root Bone : " + (selectedjoint.getParent() == null));
System.err.println("-----------------------");
System.err.println("Local translation: " + selectedjoint.getLocalTranslation());
System.err.println("Local rotation: " + selectedjoint.getLocalRotation());
System.err.println("Local scale: " + selectedjoint.getLocalScale());
System.err.println("---");
System.err.println("Model translation: " + selectedjoint.getModelTransform().getTranslation());
System.err.println("Model rotation: " + selectedjoint.getModelTransform().getRotation());
System.err.println("Model scale: " + selectedjoint.getModelTransform().getScale());
System.err.println("---");
System.err.println("Bind inverse Transform: ");
System.err.println(selectedjoint.getInverseModelBindMatrix());
return;
origin: jMonkeyEngine/jmonkeyengine

Joint root = new Joint("Root_Joint");
j1 = new Joint("Joint_1");
j2 = new Joint("Joint_2");
Joint j3 = new Joint("Joint_3");
root.addChild(j1);
j1.addChild(j2);
j2.addChild(j3);
root.setLocalTranslation(new Vector3f(0, 0, 0.5f));
j1.setLocalTranslation(new Vector3f(0, 0.0f, -0.5f));
j2.setLocalTranslation(new Vector3f(0, 0.0f, -0.3f));
j3.setLocalTranslation(new Vector3f(0, 0, -0.2f));
Joint[] joints = new Joint[]{root, j1, j2, j3};
origin: jMonkeyEngine/jmonkeyengine

  Joint joint = nameToJoint.get(jointName);
  Joint parent = nameToJoint.get(parentName);
  parent.addChild(joint);
} else if (qName.equals("bone")) {
  assert elementStack.peek().equals("bones");
  joint = new Joint(attribs.getValue("name"));
  int id = SAXUtil.parseInt(attribs.getValue("id"));
  indexToJoint.put(id, joint);
  nameToJoint.put(joint.getName(), joint);
} else if (qName.equals("tracks")) {
  assert elementStack.peek().equals("animation");
origin: jMonkeyEngine/jmonkeyengine

  logger.log(Level.WARNING, "Animation " + animationIndex + " (" + name + ") applies to joints that are not from the same skin: skin " + skinIndex + ", joint " + jw.joint.getName() + " from skin " + jw.skinIndex);
  continue;
Vector3f[] translations = new Vector3f[]{joint.getLocalTranslation()};
Quaternion[] rotations = new Quaternion[]{joint.getLocalRotation()};
Vector3f[] scales = new Vector3f[]{joint.getLocalScale()};
TransformTrack track = new TransformTrack(joint, times, translations, rotations, scales);
aTracks.add(track);
origin: jMonkeyEngine/jmonkeyengine

  axis = null;
} else if (qName.equals("bone")) {
  joint.getLocalTransform().setTranslation(position);
  joint.getLocalTransform().setRotation(rotation);
  if (scale != null) {
    joint.getLocalTransform().setScale(scale);
  translations.add(position.addLocal(joint.getLocalTranslation()));
  rotations.add(joint.getLocalRotation().mult(rotation, rotation));
  if (scale != null) {
    scales.add(scale.multLocal(joint.getLocalScale()));
  }else{
    scales.add(new Vector3f(1,1,1));
origin: jMonkeyEngine/jmonkeyengine

public Joint readNodeAsBone(int nodeIndex, int jointIndex, int skinIndex, Matrix4f inverseModelBindMatrix) throws IOException {
  JointWrapper jointWrapper = fetchFromCache("nodes", nodeIndex, JointWrapper.class);
  if (jointWrapper != null) {
    return jointWrapper.joint;
  }
  JsonObject nodeData = nodes.get(nodeIndex).getAsJsonObject();
  String name = getAsString(nodeData, "name");
  if (name == null) {
    name = "Joint_" + nodeIndex;
  }
  Joint joint = new Joint(name);
  Transform boneTransforms = null;
  boneTransforms = readTransforms(nodeData);
  joint.setLocalTransform(boneTransforms);
  joint.setInverseModelBindMatrix(inverseModelBindMatrix);
  addToCache("nodes", nodeIndex, new JointWrapper(joint, jointIndex, skinIndex), nodes.size());
  return joint;
}
origin: jMonkeyEngine/jmonkeyengine

private void findChildren(int nodeIndex) throws IOException {
  JointWrapper jw = fetchFromCache("nodes", nodeIndex, JointWrapper.class);
  JsonObject nodeData = nodes.get(nodeIndex).getAsJsonObject();
  JsonArray children = nodeData.getAsJsonArray("children");
  if (children != null) {
    for (JsonElement child : children) {
      int childIndex = child.getAsInt();
      if (jw.children.contains(childIndex)) {
        //bone already has the child in its children
        continue;
      }
      JointWrapper cjw = fetchFromCache("nodes", childIndex, JointWrapper.class);
      if (cjw != null) {
        jw.joint.addChild(cjw.joint);
        jw.children.add(childIndex);
      } else {
        //The child might be a Node
        //Creating a dummy node to read the subgraph
        Node n = new Node();
        readChild(n, child);
        Spatial s = n.getChild(0);
        //removing the spatial from the dummy node, it will be attached to the attachment node of the bone
        s.removeFromParent();
        jw.attachedSpatial = s;
      }
    }
  }
}
origin: jMonkeyEngine/jmonkeyengine

protected final void createSkeletonGeoms(Joint joint, Node joints, Node wires, Node outlines, List<Joint> deformingJoints) {
  Vector3f start = joint.getModelTransform().getTranslation().clone();
  if (!joint.getChildren().isEmpty()) {
    ends = new Vector3f[joint.getChildren().size()];
  for (int i = 0; i < joint.getChildren().size(); i++) {
    ends[i] = joint.getChildren().get(i).getModelTransform().getTranslation().clone();
  Geometry jGeom = new Geometry(joint.getName() + "Joint", new JointShape());
  jGeom.setLocalTranslation(start);
  attach(joints, deforms, jGeom);
      outlinesAttach = null;
    bGeom = new Geometry(joint.getName() + "Bone", m);
    setColor(bGeom, outlinesAttach == null ? outlineColor : baseColor);
    geomToJoint.put(bGeom, joint);
    attach(wireAttach, deforms, bGeom);
    if (outlinesAttach != null) {
      bGeomO = new Geometry(joint.getName() + "BoneOutline", mO);
      setColor(bGeomO, outlineColor);
      attach(outlinesAttach, deforms, bGeomO);
  for (Joint child : joint.getChildren()) {
    createSkeletonGeoms(child, joints, wires, outlines, deformingJoints);
origin: jMonkeyEngine/jmonkeyengine

/**
 * This methods sets this armature in its bind pose (aligned with the mesh to deform)
 * Note that this is only useful for debugging purpose.
 */
public void applyBindPose() {
  for (Joint joint : rootJoints) {
    joint.applyBindPose();
  }
}
origin: jMonkeyEngine/jmonkeyengine

Joint root = new Joint("Root_Joint");
j1 = new Joint("Joint_1");
j2 = new Joint("Joint_2");
Joint j3 = new Joint("Joint_3");
root.addChild(j1);
j1.addChild(j2);
j2.addChild(j3);
root.setLocalTranslation(new Vector3f(0, 0, 0.5f));
j1.setLocalTranslation(new Vector3f(0, 0.0f, -0.5f));
j2.setLocalTranslation(new Vector3f(0, 0.0f, -0.3f));
j3.setLocalTranslation(new Vector3f(0, 0, -0.2f));
Joint[] joints = new Joint[]{root, j1, j2, j3};
origin: jMonkeyEngine/jmonkeyengine

@Override
@SuppressWarnings("unchecked")
public void read(JmeImporter im) throws IOException {
  InputCapsule input = im.getCapsule(this);
  name = input.readString("name", null);
  attachedNode = (Node) input.readSavable("attachedNode", null);
  targetGeometry = (Geometry) input.readSavable("targetGeometry", null);
  initialTransform = (Transform) input.readSavable("initialTransform", new Transform());
  inverseModelBindMatrix = (Matrix4f) input.readSavable("inverseModelBindMatrix", inverseModelBindMatrix);
  ArrayList<Joint> childList = input.readSavableArrayList("children", null);
  for (int i = childList.size() - 1; i >= 0; i--) {
    this.addChild(childList.get(i));
  }
}
origin: jMonkeyEngine/jmonkeyengine

  joint = fromBone(bone);
j.addChild(joint);
joints[index] = joint;
origin: jMonkeyEngine/jmonkeyengine

/**
 * returns the joint with the given name
 *
 * @param name
 * @return
 */
public Joint getJoint(String name) {
  for (int i = 0; i < jointList.length; i++) {
    if (jointList[i].getName().equals(name)) {
      return jointList[i];
    }
  }
  return null;
}
origin: jMonkeyEngine/jmonkeyengine

skinData.skinningControl.getAttachmentsNode(bw.joint.getName()).attachChild(bw.attachedSpatial);
com.jme3.animJoint

Javadoc

A Joint is the basic component of an armature designed to perform skeletal animation Created by Nehon on 15/12/2017.

Most used methods

  • <init>
  • addChild
  • getLocalRotation
  • getLocalScale
  • getLocalTranslation
  • getName
  • setLocalTransform
  • setLocalTranslation
  • applyBindPose
    Sets the local transform with the bind transforms
  • applyInitialPose
    Sets the local transform with the initial transform
  • getAttachmentsNode
    Access the attachments node of this joint. If this joint doesn't already have an attachments node, c
  • getChildren
  • getAttachmentsNode,
  • getChildren,
  • getId,
  • getInverseModelBindMatrix,
  • getJointModelTransform,
  • getLocalTransform,
  • getModelTransform,
  • getOffsetTransform,
  • getParent,
  • saveBindPose

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSharedPreferences (Context)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • runOnUiThread (Activity)
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Permission (java.security)
    Abstract class for representing access to a system resource. All permissions have a name (whose inte
  • ResourceBundle (java.util)
    Resource bundles contain locale-specific objects. When your program needs a locale-specific resource
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now