/** * 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); }
/** * Add bones to be influenced by this animation channel starting from the * given bone name and going toward the root bone. */ public void addToRootBone(String name) { addToRootBone(control.getSkeleton().getBone(name)); }
/** * Add bones to be influenced by this animation channel, starting * from the given named bone and going toward its children. */ public void addFromRootBone(String name) { addFromRootBone(control.getSkeleton().getBone(name)); }
/** * Add a single bone to be influenced by this animation channel. */ public void addBone(String name) { addBone(control.getSkeleton().getBone(name)); }
public void reset(boolean rewind){ if(rewind){ setTime(0); if(control.getSkeleton()!=null){ control.getSkeleton().resetAndUpdate(); }else{ TempVars vars = TempVars.get(); update(0, vars); vars.release(); } } animation = null; notified = false; }
private void setupAnimationController() { animationControl = model.getControl(AnimControl.class); animationControl.addListener(this); animationChannel = animationControl.createChannel(); shootingChannel = animationControl.createChannel(); shootingChannel.addBone(animationControl.getSkeleton().getBone("uparm.right")); shootingChannel.addBone(animationControl.getSkeleton().getBone("arm.right")); shootingChannel.addBone(animationControl.getSkeleton().getBone("hand.right")); }
@Override public void simpleUpdate(float tpf){ Bone b = control.getSkeleton().getBone("spinehigh"); Bone b2 = control.getSkeleton().getBone("uparm.left"); angle += tpf * rate; if (angle > FastMath.HALF_PI / 2f){ angle = FastMath.HALF_PI / 2f; rate = -1; }else if (angle < -FastMath.HALF_PI / 2f){ angle = -FastMath.HALF_PI / 2f; rate = 1; } Quaternion q = new Quaternion(); q.fromAngles(0, angle, 0); b.setUserControl(true); b.setUserTransforms(Vector3f.ZERO, q, Vector3f.UNIT_XYZ); b2.setUserControl(true); b2.setUserTransforms(Vector3f.ZERO, Quaternion.IDENTITY, new Vector3f(1+angle,1+ angle, 1+angle)); }
/** * 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); } } }
/** * 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); } } }
if (control != null) { AnimComposer composer = new AnimComposer(); Skeleton skeleton = control.getSkeleton(); if (skeleton == null) {
if (animControl.getSkeleton() != skeleton) { throw new UnsupportedOperationException();
Bone target = control.getSkeleton().getBone(targetBoneIndex);
rightHand.setAnim("push"); SkeletonDebugger skeletonDebug = new SkeletonDebugger("skeleton", control.getSkeleton()); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.getAdditionalRenderState().setWireframe(true);
SkeletonDebugger skeletonDebug = new SkeletonDebugger("skeleton", control.getSkeleton()); Material mat2 = new Material(getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); mat2.getAdditionalRenderState().setWireframe(true);
/** * 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); }
/** * Add bones to be influenced by this animation channel starting from the * given bone name and going toward the root bone. */ public void addToRootBone(String name) { addToRootBone(control.getSkeleton().getBone(name)); }
/** * Add bones to be influenced by this animation channel, starting * from the given named bone and going toward its children. */ public void addFromRootBone(String name) { addFromRootBone(control.getSkeleton().getBone(name)); }
/** * Add bones to be influenced by this animation channel starting from the * given bone name and going toward the root bone. */ public void addToRootBone(String name) { addToRootBone(control.getSkeleton().getBone(name)); }
/** * Add a single bone to be influenced by this animation channel. */ public void addBone(String name) { addBone(control.getSkeleton().getBone(name)); }
public static void attachSkeleton(AssetManager am, Node player, AnimControl control) { SkeletonDebugger skeletonDebug = new SkeletonDebugger("skeleton", control.getSkeleton()); Material mat2 = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md"); mat2.setColor("Color", ColorRGBA.Yellow); mat2.getAdditionalRenderState().setDepthTest(false); skeletonDebug.setMaterial(mat2); player.attachChild(skeletonDebug); }