Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.xpogames.movinghand;
- import com.jme3.animation.AnimChannel;
- import com.jme3.animation.AnimControl;
- import com.jme3.app.SimpleApplication;
- import com.jme3.font.BitmapText;
- import com.jme3.light.DirectionalLight;
- import com.jme3.material.Material;
- import com.jme3.math.ColorRGBA;
- import com.jme3.math.Vector3f;
- import com.jme3.scene.Spatial;
- import com.jme3.scene.debug.SkeletonDebugger;
- /**
- *
- * @author ufk
- */
- public class MovingHand extends SimpleApplication {
- public static void main(String[] args){
- MovingHand app = new MovingHand();
- app.start(); // start the game
- }
- @Override
- public void simpleInitApp() {
- Spatial hand = assetManager.loadModel("Models/Worm/worm.j3o");
- Material mat_default = new Material(
- assetManager, "Common/MatDefs/Misc/ShowNormals.j3md");
- hand.setMaterial(mat_default);
- rootNode.attachChild(hand);
- hand.rotate(0,1f,1f);
- final AnimControl control = hand.getControl(AnimControl.class);
- final AnimChannel channel = control.createChannel();
- final SkeletonDebugger skeletonDebug = new SkeletonDebugger("skeleton", control.getSkeleton());
- final Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
- mat.setColor("Color", ColorRGBA.Green);
- mat.getAdditionalRenderState().setDepthTest(false);
- skeletonDebug.setMaterial(mat);
- rootNode.attachChild(skeletonDebug);
- // Create a wall with a simple texture from test_data
- // Display a line of text with a default font
- guiNode.detachAllChildren();
- guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
- BitmapText helloText = new BitmapText(guiFont, false);
- helloText.setSize(guiFont.getCharSet().getRenderedSize());
- helloText.setText("Hello World - " + (control == null ? "is null" : "is not null"));
- helloText.setLocalTranslation(300, helloText.getLineHeight(), 0);
- guiNode.attachChild(helloText);
- // Load a model from test_data (OgreXML + material + texture)
- // You must add a light to make the model visible
- DirectionalLight sun = new DirectionalLight();
- sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));
- rootNode.addLight(sun);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment