/
TestAnimation.java
41 lines (33 loc) · 1.21 KB
/
TestAnimation.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.ruanko.test;
import com.jme3.animation.AnimControl;
import com.jme3.animation.SkeletonControl;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Node;
import com.jme3.scene.debug.SkeletonDebugger;
import com.ruanko.asset.CreateAnimation;
public class TestAnimation extends TestBaseApp {
@Override
public void init() {
CreateAnimation ca = new CreateAnimation(assetManager);
AnimControl ac = ca.createAnimControl();
Node node = ca.createModel();
node.addControl(ac);
// Create SkeletonControl and add it to Node
SkeletonControl sc = new SkeletonControl(ac.getSkeleton());
node.addControl(sc);
rootNode.attachChild(node);
SkeletonDebugger sd = new SkeletonDebugger("SkeletonDebuger", ac.getSkeleton());
final Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Magenta);
mat.getAdditionalRenderState().setDepthTest(false);
sd.setMaterial(mat);
node.attachChild(sd);
ac.createChannel().setAnim("Anim");;
}
public static void main(String[] args) {
TestBaseApp app = new TestAnimation();
app.setShowSettings(false);
app.start();
}
}