Add new animations. Prepare code for animation implementation.

This commit is contained in:
sigonasr2 2019-06-17 23:50:55 +09:00
parent f5e2a711ce
commit 94bc80d9df
28 changed files with 113 additions and 13 deletions

Binary file not shown.

View File

@ -1,3 +1,3 @@
#
#Thu Jun 13 01:11:59 KST 2019
ORIGINAL_PATH=Models/Archer_finalrig/Archer_finalrig.obj
#Thu Jun 13 01:32:08 KST 2019
ORIGINAL_PATH=Models/Archer_finalrig/Archer_finalrig.mesh.xml

View File

@ -1,3 +0,0 @@
#
#Thu Jun 13 01:32:08 KST 2019
ORIGINAL_PATH=Models/Archer_finalrig/Archer_finalrig.mesh.xml

View File

@ -0,0 +1,32 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mygame;
import com.jme3.asset.AssetManager;
import com.jme3.scene.Spatial;
/**
*
* @author Joshua Sigona
*/
public class GenericFunctions {
/**
* Specify a model name. Returns the entire path.
* @return
*/
public static String ModelName(String name) {
StringBuilder sb = new StringBuilder("Models/")
.append(name)
.append("/")
.append(name)
.append(".j3o");
return sb.toString();
}
public static Spatial LoadModel(AssetManager assetManager, String name) {
return (Spatial)(assetManager.loadModel(ModelName(name)));
}
}

View File

@ -26,7 +26,7 @@ import com.jme3.scene.Node;
* @author normenhansen
*/
public class Main extends SimpleApplication implements
AnimEventListener{
AnimEventListener, ActionListener{
public static Main game;
private AnimChannel channel;
private AnimControl control;
@ -61,7 +61,7 @@ public class Main extends SimpleApplication implements
dl2.setColor(new ColorRGBA(1f, 1f, 1f, 0.5f));
dl2.setDirection(new Vector3f(0.1f, -0.7f, -1).normalizeLocal());
rootNode.addLight(dl2);
Spatial Archer = (Spatial) assetManager.loadModel("Models/Archer_finalrig/Archer_finalrig.mesh.j3o");
Spatial Archer = (Spatial) assetManager.loadModel("Models/Archer_finalrig/Archer_finalrig.j3o");
float scale = 0.05f;
Archer.scale(scale, scale, scale);
@ -97,10 +97,10 @@ public class Main extends SimpleApplication implements
rootNode.attachChild(Archer);
//rootNode.attachChild(bow);
inputManager.addMapping("Swap Weapon",
new KeyTrigger(KeyInput.KEY_SPACE));
inputManager.addMapping("Combat Stance",
new KeyTrigger(KeyInput.KEY_TAB));
ActionListener actionListener = new ActionListener(){
/*ActionListener actionListener = new ActionListener(){
public void onAction(String name, boolean pressed, float tpf){
if (pressed) {
n.detachChild(bow);
@ -117,14 +117,14 @@ public class Main extends SimpleApplication implements
n.attachChild(bow);
}
}
};
};*/
inputManager.addListener(actionListener, "Swap Weapon");
inputManager.addListener(this, "Combat Stance");
}
@Override
public void simpleUpdate(float tpf) {
//TODO: add update code
System.out.println(tpf);
}
@Override
@ -139,4 +139,15 @@ public class Main extends SimpleApplication implements
@Override
public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
}
@Override
public void onAction(String name, boolean isPressed, float tpf) {
switch (name) {
case "Combat Stance":{
if (isPressed) {
//
}
}break;
}
}
}

View File

@ -0,0 +1,60 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mygame.character;
import com.jme3.animation.AnimChannel;
import com.jme3.animation.AnimControl;
import com.jme3.animation.SkeletonControl;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import mygame.GenericFunctions;
import mygame.Main;
/**
*
* @author Joshua Sigona
*/
public class CharacterRig extends Main{
Spatial character;
String[] topbones; //Controlled only by top motion. Anything not specified here is bottom control.
AnimChannel top_channel,bot_channel;
AnimControl control;
SkeletonControl skeleton;
Node primary_hand,secondary_hand,torso;
Spatial weapon;
boolean combat_stance=false;
//Combat stance
CharacterRig(String model,String... topbones) {
this.character = GenericFunctions.LoadModel(assetManager,model);
this.topbones = topbones;
control = character.getControl(AnimControl.class);
control.addListener(Main.game);
bot_channel = control.createChannel();
top_channel = control.createChannel();
SkeletonControl skeleton = character.getControl(SkeletonControl.class);
primary_hand = skeleton.getAttachmentsNode("Left Wrist");
secondary_hand = skeleton.getAttachmentsNode("Right Wrist");
torso = skeleton.getAttachmentsNode("Torso");
}
public void setWeapon(Spatial weapon) {
this.weapon=weapon;
}
public void update(float tpf) {
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
player_archer2_so_13_g.wav Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
player_archer3_bvh_01_a.ogg Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
player_archer_bva_01_a.wav Normal file

Binary file not shown.