Environment updates, work on rotator system
This commit is contained in:
parent
5b7980f545
commit
a5031f20f6
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"java.configuration.updateBuildConfiguration": "automatic"
|
||||||
|
}
|
||||||
4
.vscode/tasks.json
vendored
4
.vscode/tasks.json
vendored
@ -29,9 +29,9 @@
|
|||||||
{
|
{
|
||||||
"label": "Run",
|
"label": "Run",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "mvn process-classes exec:java -Dexec.mainClass=\"electrosphere.main.Main\"",
|
"command": "mvn process-classes exec:exec",
|
||||||
"windows": {
|
"windows": {
|
||||||
"command": "mvn process-classes exec:java -Dexec.mainClass=\"electrosphere.main.Main\""
|
"command": "mvn process-classes exec:exec"
|
||||||
},
|
},
|
||||||
"group": "test",
|
"group": "test",
|
||||||
"presentation": {
|
"presentation": {
|
||||||
|
|||||||
@ -123,6 +123,43 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"rotatorSystem" : {
|
||||||
|
"rotatorItems" : [
|
||||||
|
{
|
||||||
|
"boneName" : "myTorsoBone",
|
||||||
|
"constraints" : [
|
||||||
|
{
|
||||||
|
"followsView" : true,
|
||||||
|
"followsBone" : false,
|
||||||
|
"parentBone" : "",
|
||||||
|
"allowedMargin" : 0.2
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"boneName" : "myLeftLegBone",
|
||||||
|
"constraints" : [
|
||||||
|
{
|
||||||
|
"followsView" : false,
|
||||||
|
"followsBone" : true,
|
||||||
|
"parentBone" : "myTorsoBone",
|
||||||
|
"allowedMargin" : 0.2
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"boneName" : "myRightLegBone",
|
||||||
|
"constraints" : [
|
||||||
|
{
|
||||||
|
"followsView" : false,
|
||||||
|
"followsBone" : true,
|
||||||
|
"parentBone" : "myTorsoBone",
|
||||||
|
"allowedMargin" : 0.2
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"collidable" : {
|
"collidable" : {
|
||||||
"type" : "CYLINDER",
|
"type" : "CYLINDER",
|
||||||
"dimension1" : 0.1,
|
"dimension1" : 0.1,
|
||||||
@ -144,7 +181,7 @@
|
|||||||
"maxHealth" : 100,
|
"maxHealth" : 100,
|
||||||
"onDamageIFrames" : 30
|
"onDamageIFrames" : 30
|
||||||
},
|
},
|
||||||
"modelPath" : "Models/person1animpass2.fbx"
|
"modelPath" : "Models/baseman.fbx"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
BIN
assets/Models/baseman.fbx
Normal file
BIN
assets/Models/baseman.fbx
Normal file
Binary file not shown.
33
pom.xml
33
pom.xml
@ -43,12 +43,12 @@
|
|||||||
<groupId>org.lwjgl</groupId>
|
<groupId>org.lwjgl</groupId>
|
||||||
<artifactId>lwjgl-openal</artifactId>
|
<artifactId>lwjgl-openal</artifactId>
|
||||||
<version>${lwjgl.version}</version>
|
<version>${lwjgl.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.lwjgl</groupId>
|
<groupId>org.lwjgl</groupId>
|
||||||
<artifactId>lwjgl-stb</artifactId>
|
<artifactId>lwjgl-stb</artifactId>
|
||||||
<version>${lwjgl.version}</version>
|
<version>${lwjgl.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- generic LWJGL runtimes -->
|
<!-- generic LWJGL runtimes -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.lwjgl</groupId>
|
<groupId>org.lwjgl</groupId>
|
||||||
@ -96,14 +96,14 @@
|
|||||||
<version>${lwjgl.version}</version>
|
<version>${lwjgl.version}</version>
|
||||||
<classifier>${lwjgl.natives}</classifier>
|
<classifier>${lwjgl.natives}</classifier>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.lwjgl</groupId>
|
<groupId>org.lwjgl</groupId>
|
||||||
<artifactId>lwjgl-stb</artifactId>
|
<artifactId>lwjgl-stb</artifactId>
|
||||||
<version>${lwjgl.version}</version>
|
<version>${lwjgl.version}</version>
|
||||||
<classifier>${lwjgl.natives}</classifier>
|
<classifier>${lwjgl.natives}</classifier>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.joml</groupId>
|
<groupId>org.joml</groupId>
|
||||||
<artifactId>joml</artifactId>
|
<artifactId>joml</artifactId>
|
||||||
@ -242,6 +242,31 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
|
<version>3.0.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>exec</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<executable>java</executable>
|
||||||
|
<includeProjectDependencies>false</includeProjectDependencies>
|
||||||
|
<includePluginDependencies>true</includePluginDependencies>
|
||||||
|
<mainClass>electrosphere.main.Main</mainClass>
|
||||||
|
<!-- <classpathScope>compile</classpathScope> -->
|
||||||
|
<arguments>
|
||||||
|
<argument>-cp</argument>
|
||||||
|
<argument>target/classes;target/Renderer-0.1-jar-with-dependencies.jar</argument>
|
||||||
|
<argument>electrosphere.main.Main</argument>
|
||||||
|
</arguments>
|
||||||
|
<!-- <classesDirectory>${project.basedir}/target/classes</classesDirectory> -->
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
46
src/main/java/electrosphere/controls/ControlCallback.java
Normal file
46
src/main/java/electrosphere/controls/ControlCallback.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package electrosphere.controls;
|
||||||
|
|
||||||
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
import org.lwjgl.glfw.GLFWKeyCallbackI;
|
||||||
|
|
||||||
|
import electrosphere.logger.LoggerInterface;
|
||||||
|
|
||||||
|
public class ControlCallback implements GLFWKeyCallbackI {
|
||||||
|
|
||||||
|
static final int KEY_VALUE_ARRAY_SIZE = 512;
|
||||||
|
|
||||||
|
boolean[] keyValues = new boolean[KEY_VALUE_ARRAY_SIZE];
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invoke(long window, int key, int scancode, int action, int mods) {
|
||||||
|
|
||||||
|
if(key >= 0 && key < KEY_VALUE_ARRAY_SIZE){
|
||||||
|
if(action == GLFW.GLFW_PRESS || action == GLFW.GLFW_REPEAT){
|
||||||
|
keyValues[key] = true;
|
||||||
|
} else {
|
||||||
|
keyValues[key] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if(key == GLFW.GLFW_KEY_D){
|
||||||
|
// System.out.println("[D]Action: " + action + " keyValues: " + keyValues[key]);
|
||||||
|
// }
|
||||||
|
// if(key == GLFW.GLFW_KEY_W){
|
||||||
|
// System.out.println("[W]Action: " + action + " keyValues: " + keyValues[key]);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* !!!WARNING!!!, will silently fail if
|
||||||
|
* @param keycode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean getKey(int keycode){
|
||||||
|
if(keycode >= 0 && keycode < KEY_VALUE_ARRAY_SIZE){
|
||||||
|
return keyValues[keycode];
|
||||||
|
} else {
|
||||||
|
LoggerInterface.loggerEngine.WARNING("Trying to get key state where keycode is undefined (<0 or >400)");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -8,6 +8,7 @@ import electrosphere.entity.EntityUtils;
|
|||||||
import electrosphere.entity.state.AttackTree;
|
import electrosphere.entity.state.AttackTree;
|
||||||
import electrosphere.entity.state.equip.EquipState;
|
import electrosphere.entity.state.equip.EquipState;
|
||||||
import electrosphere.entity.state.movement.GroundMovementTree;
|
import electrosphere.entity.state.movement.GroundMovementTree;
|
||||||
|
import electrosphere.entity.state.movement.GroundMovementTree.MovementRelativeFacing;
|
||||||
import electrosphere.entity.state.movement.GroundMovementTree.MovementTreeState;
|
import electrosphere.entity.state.movement.GroundMovementTree.MovementTreeState;
|
||||||
import electrosphere.entity.state.movement.SprintTree;
|
import electrosphere.entity.state.movement.SprintTree;
|
||||||
import electrosphere.entity.types.collision.CollisionObjUtils;
|
import electrosphere.entity.types.collision.CollisionObjUtils;
|
||||||
@ -16,17 +17,12 @@ import electrosphere.game.client.targeting.crosshair.Crosshair;
|
|||||||
import electrosphere.main.Globals;
|
import electrosphere.main.Globals;
|
||||||
import electrosphere.menu.MenuTransition;
|
import electrosphere.menu.MenuTransition;
|
||||||
import electrosphere.menu.MenuUtils;
|
import electrosphere.menu.MenuUtils;
|
||||||
import electrosphere.net.parser.net.message.EntityMessage;
|
|
||||||
import electrosphere.renderer.ui.Widget;
|
|
||||||
import electrosphere.util.Utilities;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import org.joml.Vector2f;
|
import org.joml.Vector2f;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
import static org.lwjgl.glfw.GLFW.*;
|
import static org.lwjgl.glfw.GLFW.*;
|
||||||
import static org.lwjgl.glfw.GLFW.glfwGetCursorPos;
|
import static org.lwjgl.glfw.GLFW.glfwGetCursorPos;
|
||||||
import static org.lwjgl.glfw.GLFW.glfwGetKey;
|
|
||||||
import static org.lwjgl.glfw.GLFW.glfwGetMouseButton;
|
import static org.lwjgl.glfw.GLFW.glfwGetMouseButton;
|
||||||
import static org.lwjgl.glfw.GLFW.glfwSetInputMode;
|
import static org.lwjgl.glfw.GLFW.glfwSetInputMode;
|
||||||
|
|
||||||
@ -112,7 +108,7 @@ public class ControlHandler {
|
|||||||
HashMap<String, Control> controls;
|
HashMap<String, Control> controls;
|
||||||
|
|
||||||
ControlHandler(){
|
ControlHandler(){
|
||||||
controls = new HashMap();
|
controls = new HashMap<String, Control>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ControlHandler generateExampleControlsMap(){
|
public static ControlHandler generateExampleControlsMap(){
|
||||||
@ -221,7 +217,8 @@ public class ControlHandler {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case TITLE_PAGE:
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
case TITLE_MENU:
|
case TITLE_MENU:
|
||||||
@ -252,12 +249,20 @@ public class ControlHandler {
|
|||||||
Move forward
|
Move forward
|
||||||
*/
|
*/
|
||||||
if(controls.containsKey(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD)){
|
if(controls.containsKey(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD)){
|
||||||
if(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && glfwGetKey(Globals.window, controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue()) == GLFW_PRESS){
|
if(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())){
|
||||||
Vector3d newFacingVector = new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).normalize();
|
Vector3d newFacingVector = new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).normalize();
|
||||||
CreatureUtils.setMovementVector(Globals.playerCharacter, newFacingVector);
|
CreatureUtils.setFacingVector(Globals.playerCharacter, newFacingVector);
|
||||||
// System.out.println("Movement vector: " + newFacingVector);
|
// System.out.println("Movement vector: " + newFacingVector);
|
||||||
if(movementTree.getState()==MovementTreeState.IDLE || movementTree.getState()==MovementTreeState.SLOWDOWN){
|
if(movementTree.getState()==MovementTreeState.IDLE || movementTree.getState()==MovementTreeState.SLOWDOWN || movementTree.getFacing() != MovementRelativeFacing.FORWARD){
|
||||||
movementTree.start();
|
if(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT).isIsKey() && Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT).getKeyValue())){
|
||||||
|
movementTree.start(MovementRelativeFacing.FORWARD_LEFT);
|
||||||
|
} else if(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT).isIsKey() && Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT).getKeyValue())){
|
||||||
|
movementTree.start(MovementRelativeFacing.FORWARD_RIGHT);
|
||||||
|
// System.out.println("f-r");
|
||||||
|
} else {
|
||||||
|
// System.out.println(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT).isIsKey() + "&&" + Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT).getKeyValue()));
|
||||||
|
movementTree.start(MovementRelativeFacing.FORWARD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).setState(true);
|
controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).setState(true);
|
||||||
//send to server
|
//send to server
|
||||||
@ -281,10 +286,16 @@ public class ControlHandler {
|
|||||||
Move backward
|
Move backward
|
||||||
*/
|
*/
|
||||||
if(controls.containsKey(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD)){
|
if(controls.containsKey(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD)){
|
||||||
if(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && glfwGetKey(Globals.window, controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()) == GLFW_PRESS){
|
if(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue())){
|
||||||
CreatureUtils.setMovementVector(Globals.playerCharacter, new Vector3d(cameraEyeVector.x,0,cameraEyeVector.z).normalize());
|
CreatureUtils.setFacingVector(Globals.playerCharacter, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).normalize());
|
||||||
if(movementTree.getState()==MovementTreeState.IDLE || movementTree.getState()==MovementTreeState.SLOWDOWN){
|
if(movementTree.getState()==MovementTreeState.IDLE || movementTree.getState()==MovementTreeState.SLOWDOWN || movementTree.getFacing() != MovementRelativeFacing.BACKWARD){
|
||||||
movementTree.start();
|
if(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT).isIsKey() && Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT).getKeyValue())){
|
||||||
|
movementTree.start(MovementRelativeFacing.BACKWARD_LEFT);
|
||||||
|
} else if(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT).isIsKey() && Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT).getKeyValue())){
|
||||||
|
movementTree.start(MovementRelativeFacing.BACKWARD_RIGHT);
|
||||||
|
} else {
|
||||||
|
movementTree.start(MovementRelativeFacing.BACKWARD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).setState(true);
|
controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).setState(true);
|
||||||
//send to server
|
//send to server
|
||||||
@ -308,10 +319,14 @@ public class ControlHandler {
|
|||||||
Move left
|
Move left
|
||||||
*/
|
*/
|
||||||
if(controls.containsKey(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT)){
|
if(controls.containsKey(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT)){
|
||||||
if(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT).isIsKey() && glfwGetKey(Globals.window, controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT).getKeyValue()) == GLFW_PRESS){
|
if(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT).isIsKey() && Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT).getKeyValue())){
|
||||||
CreatureUtils.setMovementVector(Globals.playerCharacter, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY((float)(90 * Math.PI / 180)).normalize());
|
CreatureUtils.setFacingVector(Globals.playerCharacter, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z));
|
||||||
if(movementTree.getState()==MovementTreeState.IDLE || movementTree.getState()==MovementTreeState.SLOWDOWN){
|
if(
|
||||||
movementTree.start();
|
(movementTree.getState()==MovementTreeState.IDLE || movementTree.getState()==MovementTreeState.SLOWDOWN) &&
|
||||||
|
(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
||||||
|
(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
|
||||||
|
){
|
||||||
|
movementTree.start(MovementRelativeFacing.LEFT);
|
||||||
}
|
}
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT).setState(true);
|
controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT).setState(true);
|
||||||
//send to server
|
//send to server
|
||||||
@ -335,10 +350,14 @@ public class ControlHandler {
|
|||||||
Move right
|
Move right
|
||||||
*/
|
*/
|
||||||
if(controls.containsKey(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT)){
|
if(controls.containsKey(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT)){
|
||||||
if(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT).isIsKey() && glfwGetKey(Globals.window, controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT).getKeyValue()) == GLFW_PRESS){
|
if(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT).isIsKey() && Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT).getKeyValue())){
|
||||||
CreatureUtils.setMovementVector(Globals.playerCharacter, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY((float)(-90 * Math.PI / 180)).normalize());
|
CreatureUtils.setFacingVector(Globals.playerCharacter, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z));
|
||||||
if(movementTree.getState()==MovementTreeState.IDLE || movementTree.getState()==MovementTreeState.SLOWDOWN){
|
if(
|
||||||
movementTree.start();
|
(movementTree.getState()==MovementTreeState.IDLE || movementTree.getState()==MovementTreeState.SLOWDOWN) &&
|
||||||
|
(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
||||||
|
(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
|
||||||
|
){
|
||||||
|
movementTree.start(MovementRelativeFacing.RIGHT);
|
||||||
}
|
}
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT).setState(true);
|
controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT).setState(true);
|
||||||
//send to server
|
//send to server
|
||||||
@ -361,20 +380,20 @@ public class ControlHandler {
|
|||||||
/*
|
/*
|
||||||
Move up
|
Move up
|
||||||
*/
|
*/
|
||||||
if(controls.containsKey(DATA_STRING_INPUT_CODE_MOVEMENT_JUMP) && glfwGetKey(Globals.window, controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_JUMP).getKeyValue()) == GLFW_PRESS){
|
if(controls.containsKey(DATA_STRING_INPUT_CODE_MOVEMENT_JUMP) && Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_JUMP).getKeyValue())){
|
||||||
EntityUtils.getPosition(Globals.playerCharacter).add(new Vector3f(0,0.6f,0).mul(1f));
|
EntityUtils.getPosition(Globals.playerCharacter).add(new Vector3f(0,0.6f,0).mul(1f));
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Move down
|
Move down
|
||||||
*/
|
*/
|
||||||
if(controls.containsKey(DATA_STRING_INPUT_CODE_MOVEMENT_FALL) && glfwGetKey(Globals.window, controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_FALL).getKeyValue()) == GLFW_PRESS){
|
if(controls.containsKey(DATA_STRING_INPUT_CODE_MOVEMENT_FALL) && Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MOVEMENT_FALL).getKeyValue())){
|
||||||
EntityUtils.getPosition(Globals.playerCharacter).add(new Vector3f(0,-0.6f,0).mul(1f));
|
EntityUtils.getPosition(Globals.playerCharacter).add(new Vector3f(0,-0.6f,0).mul(1f));
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Sprint
|
Sprint
|
||||||
*/
|
*/
|
||||||
if(controls.containsKey(INPUT_CODE_SPRINT)){
|
if(controls.containsKey(INPUT_CODE_SPRINT)){
|
||||||
if(controls.get(INPUT_CODE_SPRINT).isIsKey() && glfwGetKey(Globals.window, controls.get(INPUT_CODE_SPRINT).getKeyValue()) == GLFW_PRESS){
|
if(controls.get(INPUT_CODE_SPRINT).isIsKey() && Globals.controlCallback.getKey(controls.get(INPUT_CODE_SPRINT).getKeyValue())){
|
||||||
if(controls.get(INPUT_CODE_SPRINT).isState() == false){
|
if(controls.get(INPUT_CODE_SPRINT).isState() == false){
|
||||||
if(sprintTree != null){
|
if(sprintTree != null){
|
||||||
sprintTree.start();
|
sprintTree.start();
|
||||||
@ -395,7 +414,7 @@ public class ControlHandler {
|
|||||||
Interact
|
Interact
|
||||||
*/
|
*/
|
||||||
if(controls.containsKey(INPUT_CODE_INTERACT)){
|
if(controls.containsKey(INPUT_CODE_INTERACT)){
|
||||||
if(controls.get(INPUT_CODE_INTERACT).isIsKey() && glfwGetKey(Globals.window, controls.get(INPUT_CODE_INTERACT).getKeyValue()) == GLFW_PRESS){
|
if(controls.get(INPUT_CODE_INTERACT).isIsKey() && Globals.controlCallback.getKey(controls.get(INPUT_CODE_INTERACT).getKeyValue())){
|
||||||
if(controls.get(INPUT_CODE_INTERACT).isState() == false){
|
if(controls.get(INPUT_CODE_INTERACT).isState() == false){
|
||||||
if(Globals.playerCharacter.getDataKeys().contains(EntityDataStrings.EQUIP_STATE) && Crosshair.hasTarget()){
|
if(Globals.playerCharacter.getDataKeys().contains(EntityDataStrings.EQUIP_STATE) && Crosshair.hasTarget()){
|
||||||
EquipState equipState = (EquipState)Globals.playerCharacter.getData(EntityDataStrings.EQUIP_STATE);
|
EquipState equipState = (EquipState)Globals.playerCharacter.getData(EntityDataStrings.EQUIP_STATE);
|
||||||
@ -414,7 +433,7 @@ public class ControlHandler {
|
|||||||
Drop
|
Drop
|
||||||
*/
|
*/
|
||||||
if(controls.containsKey(INPUT_CODE_DROP)){
|
if(controls.containsKey(INPUT_CODE_DROP)){
|
||||||
if(controls.get(INPUT_CODE_DROP).isIsKey() && glfwGetKey(Globals.window, controls.get(INPUT_CODE_DROP).getKeyValue()) == GLFW_PRESS){
|
if(controls.get(INPUT_CODE_DROP).isIsKey() && Globals.controlCallback.getKey(controls.get(INPUT_CODE_DROP).getKeyValue())){
|
||||||
if(controls.get(INPUT_CODE_DROP).isState() == false){
|
if(controls.get(INPUT_CODE_DROP).isState() == false){
|
||||||
if(Globals.playerCharacter.getDataKeys().contains(EntityDataStrings.EQUIP_STATE)){
|
if(Globals.playerCharacter.getDataKeys().contains(EntityDataStrings.EQUIP_STATE)){
|
||||||
EquipState equipState = (EquipState)Globals.playerCharacter.getData(EntityDataStrings.EQUIP_STATE);
|
EquipState equipState = (EquipState)Globals.playerCharacter.getData(EntityDataStrings.EQUIP_STATE);
|
||||||
@ -436,7 +455,7 @@ public class ControlHandler {
|
|||||||
if(controls.get(DATA_STRING_INPUT_CODE_ATTACK_PRIMARY).isIsMouse() && glfwGetMouseButton(Globals.window, controls.get(DATA_STRING_INPUT_CODE_ATTACK_PRIMARY).getKeyValue()) == GLFW_PRESS){
|
if(controls.get(DATA_STRING_INPUT_CODE_ATTACK_PRIMARY).isIsMouse() && glfwGetMouseButton(Globals.window, controls.get(DATA_STRING_INPUT_CODE_ATTACK_PRIMARY).getKeyValue()) == GLFW_PRESS){
|
||||||
if(controls.get(DATA_STRING_INPUT_CODE_ATTACK_PRIMARY).isState() == false){
|
if(controls.get(DATA_STRING_INPUT_CODE_ATTACK_PRIMARY).isState() == false){
|
||||||
if(attackTree != null){
|
if(attackTree != null){
|
||||||
CreatureUtils.setMovementVector(Globals.playerCharacter, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).normalize());
|
CreatureUtils.setFacingVector(Globals.playerCharacter, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).normalize());
|
||||||
attackTree.start(EntityDataStrings.ATTACK_MOVE_TYPE_MELEE_SWING_ONE_HAND);
|
attackTree.start(EntityDataStrings.ATTACK_MOVE_TYPE_MELEE_SWING_ONE_HAND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -475,7 +494,7 @@ public class ControlHandler {
|
|||||||
Main menu dialog toggle
|
Main menu dialog toggle
|
||||||
*/
|
*/
|
||||||
if(controls.containsKey(DATA_STRING_INPUT_CODE_IN_GAME_MAIN_MENU)){
|
if(controls.containsKey(DATA_STRING_INPUT_CODE_IN_GAME_MAIN_MENU)){
|
||||||
if(controls.get(DATA_STRING_INPUT_CODE_IN_GAME_MAIN_MENU).isIsKey() && glfwGetKey(Globals.window, controls.get(DATA_STRING_INPUT_CODE_IN_GAME_MAIN_MENU).getKeyValue()) == GLFW_PRESS){
|
if(controls.get(DATA_STRING_INPUT_CODE_IN_GAME_MAIN_MENU).isIsKey() && Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_IN_GAME_MAIN_MENU).getKeyValue())){
|
||||||
controls.get(DATA_STRING_INPUT_CODE_IN_GAME_MAIN_MENU).setState(true);
|
controls.get(DATA_STRING_INPUT_CODE_IN_GAME_MAIN_MENU).setState(true);
|
||||||
} else {
|
} else {
|
||||||
if(controls.get(DATA_STRING_INPUT_CODE_IN_GAME_MAIN_MENU).isState() == true){
|
if(controls.get(DATA_STRING_INPUT_CODE_IN_GAME_MAIN_MENU).isState() == true){
|
||||||
@ -495,7 +514,7 @@ public class ControlHandler {
|
|||||||
|
|
||||||
public void pollInGameDebugControls(){
|
public void pollInGameDebugControls(){
|
||||||
if(controls.containsKey(DATA_STRING_INPUT_CODE_DEBUG_SPAWN_ITEM)){
|
if(controls.containsKey(DATA_STRING_INPUT_CODE_DEBUG_SPAWN_ITEM)){
|
||||||
if(controls.get(DATA_STRING_INPUT_CODE_DEBUG_SPAWN_ITEM).isIsKey() && glfwGetKey(Globals.window, controls.get(DATA_STRING_INPUT_CODE_DEBUG_SPAWN_ITEM).getKeyValue()) == GLFW_PRESS){
|
if(controls.get(DATA_STRING_INPUT_CODE_DEBUG_SPAWN_ITEM).isIsKey() && Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_DEBUG_SPAWN_ITEM).getKeyValue())){
|
||||||
controls.get(DATA_STRING_INPUT_CODE_DEBUG_SPAWN_ITEM).setState(true);
|
controls.get(DATA_STRING_INPUT_CODE_DEBUG_SPAWN_ITEM).setState(true);
|
||||||
} else {
|
} else {
|
||||||
if(controls.get(DATA_STRING_INPUT_CODE_DEBUG_SPAWN_ITEM).isState() == true){
|
if(controls.get(DATA_STRING_INPUT_CODE_DEBUG_SPAWN_ITEM).isState() == true){
|
||||||
@ -510,7 +529,7 @@ public class ControlHandler {
|
|||||||
|
|
||||||
public void pollMenuNavigationControls(){
|
public void pollMenuNavigationControls(){
|
||||||
if(controls.containsKey(DATA_STRING_INPUT_CODE_MENU_INCREMENT)){
|
if(controls.containsKey(DATA_STRING_INPUT_CODE_MENU_INCREMENT)){
|
||||||
if(controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).isIsKey() && glfwGetKey(Globals.window, controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).getKeyValue()) == GLFW_PRESS){
|
if(controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).isIsKey() && Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).getKeyValue())){
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).setState(true);
|
controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).setState(true);
|
||||||
} else {
|
} else {
|
||||||
if(controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).isState() == true){
|
if(controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).isState() == true){
|
||||||
@ -520,7 +539,7 @@ public class ControlHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(controls.containsKey(DATA_STRING_INPUT_CODE_MENU_DECREMENT)){
|
if(controls.containsKey(DATA_STRING_INPUT_CODE_MENU_DECREMENT)){
|
||||||
if(controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).isIsKey() && glfwGetKey(Globals.window, controls.get(DATA_STRING_INPUT_CODE_MENU_DECREMENT).getKeyValue()) == GLFW_PRESS){
|
if(controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).isIsKey() && Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MENU_DECREMENT).getKeyValue())){
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MENU_DECREMENT).setState(true);
|
controls.get(DATA_STRING_INPUT_CODE_MENU_DECREMENT).setState(true);
|
||||||
} else {
|
} else {
|
||||||
if(controls.get(DATA_STRING_INPUT_CODE_MENU_DECREMENT).isState() == true){
|
if(controls.get(DATA_STRING_INPUT_CODE_MENU_DECREMENT).isState() == true){
|
||||||
@ -530,7 +549,7 @@ public class ControlHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(controls.containsKey(DATA_STRING_INPUT_CODE_MENU_SELECT)){
|
if(controls.containsKey(DATA_STRING_INPUT_CODE_MENU_SELECT)){
|
||||||
if(controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).isIsKey() && glfwGetKey(Globals.window, controls.get(DATA_STRING_INPUT_CODE_MENU_SELECT).getKeyValue()) == GLFW_PRESS){
|
if(controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).isIsKey() && Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MENU_SELECT).getKeyValue())){
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MENU_SELECT).setState(true);
|
controls.get(DATA_STRING_INPUT_CODE_MENU_SELECT).setState(true);
|
||||||
} else {
|
} else {
|
||||||
if(controls.get(DATA_STRING_INPUT_CODE_MENU_SELECT).isState() == true){
|
if(controls.get(DATA_STRING_INPUT_CODE_MENU_SELECT).isState() == true){
|
||||||
@ -540,7 +559,7 @@ public class ControlHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(controls.containsKey(DATA_STRING_INPUT_CODE_MENU_BACKOUT)){
|
if(controls.containsKey(DATA_STRING_INPUT_CODE_MENU_BACKOUT)){
|
||||||
if(controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).isIsKey() && glfwGetKey(Globals.window, controls.get(DATA_STRING_INPUT_CODE_MENU_BACKOUT).getKeyValue()) == GLFW_PRESS){
|
if(controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).isIsKey() && Globals.controlCallback.getKey(controls.get(DATA_STRING_INPUT_CODE_MENU_BACKOUT).getKeyValue())){
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MENU_BACKOUT).setState(true);
|
controls.get(DATA_STRING_INPUT_CODE_MENU_BACKOUT).setState(true);
|
||||||
} else {
|
} else {
|
||||||
if(controls.get(DATA_STRING_INPUT_CODE_MENU_BACKOUT).isState() == true){
|
if(controls.get(DATA_STRING_INPUT_CODE_MENU_BACKOUT).isState() == true){
|
||||||
@ -568,7 +587,7 @@ public class ControlHandler {
|
|||||||
DATA_STRING_INPUT_CODE_MENU_TYPE_PERIOD,
|
DATA_STRING_INPUT_CODE_MENU_TYPE_PERIOD,
|
||||||
};
|
};
|
||||||
for(String currentKey : typeKeybinds){
|
for(String currentKey : typeKeybinds){
|
||||||
if(controls.get(currentKey).isIsKey() && glfwGetKey(Globals.window, controls.get(currentKey).getKeyValue()) == GLFW_PRESS){
|
if(controls.get(currentKey).isIsKey() && Globals.controlCallback.getKey(controls.get(currentKey).getKeyValue())){
|
||||||
controls.get(currentKey).setState(true);
|
controls.get(currentKey).setState(true);
|
||||||
} else {
|
} else {
|
||||||
if(controls.get(currentKey).isState() == true){
|
if(controls.get(currentKey).isState() == true){
|
||||||
|
|||||||
@ -33,7 +33,7 @@ public class EntityDataStrings {
|
|||||||
public static final String DATA_STRING_CREATURE_CONTROLLER_PLAYER_ID = "creaturePlayerId";
|
public static final String DATA_STRING_CREATURE_CONTROLLER_PLAYER_ID = "creaturePlayerId";
|
||||||
public static final String DATA_STRING_MOVEMENT_BT = "movementBT";
|
public static final String DATA_STRING_MOVEMENT_BT = "movementBT";
|
||||||
public static final String SPRINT_TREE = "sprintBT";
|
public static final String SPRINT_TREE = "sprintBT";
|
||||||
public static final String DATA_STRING_MOVEMENT_VECTOR = "movementVector";
|
public static final String DATA_STRING_FACING_VECTOR = "facingVector";
|
||||||
public static final String DATA_STRING_VELOCITY = "velocity";
|
public static final String DATA_STRING_VELOCITY = "velocity";
|
||||||
public static final String DATA_STRING_ACCELERATION = "acceleration";
|
public static final String DATA_STRING_ACCELERATION = "acceleration";
|
||||||
public static final String DATA_STRING_MAX_NATURAL_VELOCITY = "velocityMaxNatural";
|
public static final String DATA_STRING_MAX_NATURAL_VELOCITY = "velocityMaxNatural";
|
||||||
|
|||||||
@ -66,7 +66,7 @@ public class AttackTree {
|
|||||||
if(parent.getDataKeys().contains(EntityDataStrings.DATA_STRING_MOVEMENT_BT)){
|
if(parent.getDataKeys().contains(EntityDataStrings.DATA_STRING_MOVEMENT_BT)){
|
||||||
CreatureUtils.getEntityMovementTree(parent).interrupt();
|
CreatureUtils.getEntityMovementTree(parent).interrupt();
|
||||||
}
|
}
|
||||||
Vector3d movementVector = CreatureUtils.getMovementVector(parent);
|
Vector3d movementVector = CreatureUtils.getFacingVector(parent);
|
||||||
EntityUtils.getRotation(parent).rotationTo(new Vector3f(0,0,1), new Vector3f((float)movementVector.x,(float)movementVector.y,(float)movementVector.z));
|
EntityUtils.getRotation(parent).rotationTo(new Vector3f(0,0,1), new Vector3f((float)movementVector.x,(float)movementVector.y,(float)movementVector.z));
|
||||||
state = AttackTreeState.WINDUP;
|
state = AttackTreeState.WINDUP;
|
||||||
frameCurrent = 0;
|
frameCurrent = 0;
|
||||||
@ -85,7 +85,7 @@ public class AttackTree {
|
|||||||
float velocity = CreatureUtils.getVelocity(parent);
|
float velocity = CreatureUtils.getVelocity(parent);
|
||||||
Actor entityActor = EntityUtils.getActor(parent);
|
Actor entityActor = EntityUtils.getActor(parent);
|
||||||
Vector3d position = EntityUtils.getPosition(parent);
|
Vector3d position = EntityUtils.getPosition(parent);
|
||||||
Vector3d movementVector = CreatureUtils.getMovementVector(parent);
|
Vector3d movementVector = CreatureUtils.getFacingVector(parent);
|
||||||
|
|
||||||
//parse attached network messages
|
//parse attached network messages
|
||||||
for(EntityMessage message : networkMessageQueue){
|
for(EntityMessage message : networkMessageQueue){
|
||||||
@ -120,7 +120,7 @@ public class AttackTree {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EntityUtils.getPosition(parent).set(message.getpositionX(),message.getpositionY(),message.getpositionZ());
|
EntityUtils.getPosition(parent).set(message.getpositionX(),message.getpositionY(),message.getpositionZ());
|
||||||
CreatureUtils.setMovementVector(parent, new Vector3d(message.getrotationX(),message.getrotationY(),message.getrotationZ()));
|
CreatureUtils.setFacingVector(parent, new Vector3d(message.getrotationX(),message.getrotationY(),message.getrotationZ()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,7 +84,7 @@ public class IdleTree {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
EntityUtils.getPosition(parent).set(message.getpositionX(),message.getpositionY(),message.getpositionZ());
|
EntityUtils.getPosition(parent).set(message.getpositionX(),message.getpositionY(),message.getpositionZ());
|
||||||
CreatureUtils.setMovementVector(parent, new Vector3d(message.getrotationX(),message.getrotationY(),message.getrotationZ()));
|
CreatureUtils.setFacingVector(parent, new Vector3d(message.getrotationX(),message.getrotationY(),message.getrotationZ()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,6 +43,17 @@ public class GroundMovementTree {
|
|||||||
IDLE,
|
IDLE,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static enum MovementRelativeFacing {
|
||||||
|
FORWARD,
|
||||||
|
LEFT,
|
||||||
|
RIGHT,
|
||||||
|
BACKWARD,
|
||||||
|
FORWARD_LEFT,
|
||||||
|
FORWARD_RIGHT,
|
||||||
|
BACKWARD_LEFT,
|
||||||
|
BACKWARD_RIGHT,
|
||||||
|
}
|
||||||
|
|
||||||
static final double STATE_DIFFERENCE_HARD_UPDATE_THRESHOLD = 1.0;
|
static final double STATE_DIFFERENCE_HARD_UPDATE_THRESHOLD = 1.0;
|
||||||
static final double STATE_DIFFERENCE_SOFT_UPDATE_THRESHOLD = 0.2;
|
static final double STATE_DIFFERENCE_SOFT_UPDATE_THRESHOLD = 0.2;
|
||||||
static final double SOFT_UPDATE_MULTIPLIER = 0.1;
|
static final double SOFT_UPDATE_MULTIPLIER = 0.1;
|
||||||
@ -55,6 +66,7 @@ public class GroundMovementTree {
|
|||||||
String animationSprintWindDown = Animation.ANIMATION_SPRINT_WINDDOWN;
|
String animationSprintWindDown = Animation.ANIMATION_SPRINT_WINDDOWN;
|
||||||
|
|
||||||
MovementTreeState state;
|
MovementTreeState state;
|
||||||
|
MovementRelativeFacing facing;
|
||||||
|
|
||||||
SprintTree sprintTree;
|
SprintTree sprintTree;
|
||||||
|
|
||||||
@ -69,6 +81,7 @@ public class GroundMovementTree {
|
|||||||
|
|
||||||
public GroundMovementTree(Entity e, Collidable collidable){
|
public GroundMovementTree(Entity e, Collidable collidable){
|
||||||
state = MovementTreeState.IDLE;
|
state = MovementTreeState.IDLE;
|
||||||
|
facing = MovementRelativeFacing.FORWARD;
|
||||||
parent = e;
|
parent = e;
|
||||||
this.collidable = collidable;
|
this.collidable = collidable;
|
||||||
}
|
}
|
||||||
@ -77,9 +90,10 @@ public class GroundMovementTree {
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start(){
|
public void start(MovementRelativeFacing facing){
|
||||||
//TODO: check if can start moving
|
//TODO: check if can start moving
|
||||||
if(canStartMoving()){
|
if(canStartMoving()){
|
||||||
|
this.facing = facing;
|
||||||
state = MovementTreeState.STARTUP;
|
state = MovementTreeState.STARTUP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,9 +114,36 @@ public class GroundMovementTree {
|
|||||||
Actor entityActor = EntityUtils.getActor(parent);
|
Actor entityActor = EntityUtils.getActor(parent);
|
||||||
// Model entityModel = Globals.assetManager.fetchModel(EntityUtils.getEntityModelPath(parent));
|
// Model entityModel = Globals.assetManager.fetchModel(EntityUtils.getEntityModelPath(parent));
|
||||||
Vector3d position = EntityUtils.getPosition(parent);
|
Vector3d position = EntityUtils.getPosition(parent);
|
||||||
Vector3d movementVector = CreatureUtils.getMovementVector(parent);
|
Vector3d facingVector = CreatureUtils.getFacingVector(parent);
|
||||||
|
Vector3d movementVector = new Vector3d(facingVector);
|
||||||
|
switch(facing){
|
||||||
|
case FORWARD:
|
||||||
|
break;
|
||||||
|
case LEFT:
|
||||||
|
movementVector.rotateY((float)(90 * Math.PI / 180)).normalize();
|
||||||
|
break;
|
||||||
|
case RIGHT:
|
||||||
|
movementVector.rotateY((float)(-90 * Math.PI / 180)).normalize();
|
||||||
|
break;
|
||||||
|
case BACKWARD:
|
||||||
|
movementVector.x = -movementVector.x;
|
||||||
|
movementVector.z = -movementVector.z;
|
||||||
|
break;
|
||||||
|
case FORWARD_LEFT:
|
||||||
|
movementVector.rotateY((float)(45 * Math.PI / 180)).normalize();
|
||||||
|
break;
|
||||||
|
case FORWARD_RIGHT:
|
||||||
|
movementVector.rotateY((float)(-45 * Math.PI / 180)).normalize();
|
||||||
|
break;
|
||||||
|
case BACKWARD_LEFT:
|
||||||
|
movementVector.rotateY((float)(135 * Math.PI / 180)).normalize();
|
||||||
|
break;
|
||||||
|
case BACKWARD_RIGHT:
|
||||||
|
movementVector.rotateY((float)(-135 * Math.PI / 180)).normalize();
|
||||||
|
break;
|
||||||
|
}
|
||||||
// float movementYaw = CameraEntityUtils.getCameraYaw(Globals.playerCamera);
|
// float movementYaw = CameraEntityUtils.getCameraYaw(Globals.playerCamera);
|
||||||
Quaternionf movementQuaternion = new Quaternionf().rotationTo(new Vector3f(0,0,1), new Vector3f((float)movementVector.x,0,(float)movementVector.z)).normalize();
|
Quaternionf movementQuaternion = new Quaternionf().rotationTo(new Vector3f(0,0,1), new Vector3f((float)facingVector.x,0,(float)facingVector.z)).normalize();
|
||||||
Quaternionf rotation = EntityUtils.getRotation(parent);
|
Quaternionf rotation = EntityUtils.getRotation(parent);
|
||||||
|
|
||||||
//parse attached network messages
|
//parse attached network messages
|
||||||
@ -160,11 +201,14 @@ public class GroundMovementTree {
|
|||||||
} else if(position.distance(message.getpositionX(),message.getpositionY(),message.getpositionZ()) > STATE_DIFFERENCE_SOFT_UPDATE_THRESHOLD){
|
} else if(position.distance(message.getpositionX(),message.getpositionY(),message.getpositionZ()) > STATE_DIFFERENCE_SOFT_UPDATE_THRESHOLD){
|
||||||
EntityUtils.getPosition(parent).add(new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()).mul(SOFT_UPDATE_MULTIPLIER));
|
EntityUtils.getPosition(parent).add(new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()).mul(SOFT_UPDATE_MULTIPLIER));
|
||||||
}
|
}
|
||||||
CreatureUtils.setMovementVector(parent, new Vector3d(message.getrotationX(),message.getrotationY(),message.getrotationZ()));
|
CreatureUtils.setFacingVector(parent, new Vector3d(message.getrotationX(),message.getrotationY(),message.getrotationZ()));
|
||||||
// EntityUtils.getEntityRotation(parent).set(message.getrotationX(), message.getrotationY(), message.getrotationZ(), message.getrotationW()).normalize();
|
// EntityUtils.getEntityRotation(parent).set(message.getrotationX(), message.getrotationY(), message.getrotationZ(), message.getrotationW()).normalize();
|
||||||
// velocity = message.getvelocity();
|
// velocity = message.getvelocity();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,17 +220,22 @@ public class GroundMovementTree {
|
|||||||
velocity = velocity + acceleration * Main.deltaTime;
|
velocity = velocity + acceleration * Main.deltaTime;
|
||||||
CreatureUtils.setVelocity(parent, velocity);
|
CreatureUtils.setVelocity(parent, velocity);
|
||||||
if(entityActor != null){
|
if(entityActor != null){
|
||||||
if(sprintTree != null && sprintTree.state == SprintTreeState.SPRINTING){
|
String animationToPlay = determineCorrectAnimation();
|
||||||
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationSprintStart)){
|
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationToPlay)){
|
||||||
entityActor.playAnimation(animationSprintStart,1);
|
entityActor.playAnimation(animationToPlay,1);
|
||||||
entityActor.incrementAnimationTime(0.01);
|
entityActor.incrementAnimationTime(0.01);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationStartUp)){
|
|
||||||
entityActor.playAnimation(animationStartUp,1);
|
|
||||||
entityActor.incrementAnimationTime(0.01);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// if(sprintTree != null && sprintTree.state == SprintTreeState.SPRINTING){
|
||||||
|
// if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationSprintStart)){
|
||||||
|
// entityActor.playAnimation(animationSprintStart,1);
|
||||||
|
// entityActor.incrementAnimationTime(0.01);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationStartUp)){
|
||||||
|
// entityActor.playAnimation(animationStartUp,1);
|
||||||
|
// entityActor.incrementAnimationTime(0.01);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
//check if can transition state
|
//check if can transition state
|
||||||
if(velocity >= maxNaturalVelocity){
|
if(velocity >= maxNaturalVelocity){
|
||||||
@ -260,17 +309,22 @@ public class GroundMovementTree {
|
|||||||
//check if can restart animation
|
//check if can restart animation
|
||||||
//if yes, restart animation
|
//if yes, restart animation
|
||||||
if(entityActor != null){
|
if(entityActor != null){
|
||||||
if(sprintTree != null && sprintTree.state == SprintTreeState.SPRINTING){
|
String animationToPlay = determineCorrectAnimation();
|
||||||
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationSprint)){
|
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationToPlay)){
|
||||||
entityActor.playAnimation(animationSprint,1);
|
entityActor.playAnimation(animationToPlay,1);
|
||||||
entityActor.incrementAnimationTime(0.01);
|
entityActor.incrementAnimationTime(0.01);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationMain)){
|
|
||||||
entityActor.playAnimation(animationMain,1);
|
|
||||||
entityActor.incrementAnimationTime(0.01);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// if(sprintTree != null && sprintTree.state == SprintTreeState.SPRINTING){
|
||||||
|
// if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationSprint)){
|
||||||
|
// entityActor.playAnimation(animationSprint,1);
|
||||||
|
// entityActor.incrementAnimationTime(0.01);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationMain)){
|
||||||
|
// entityActor.playAnimation(animationMain,1);
|
||||||
|
// entityActor.incrementAnimationTime(0.01);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
if(velocity != maxNaturalVelocity){
|
if(velocity != maxNaturalVelocity){
|
||||||
velocity = maxNaturalVelocity;
|
velocity = maxNaturalVelocity;
|
||||||
@ -342,17 +396,22 @@ public class GroundMovementTree {
|
|||||||
velocity = velocity - acceleration * Main.deltaTime;
|
velocity = velocity - acceleration * Main.deltaTime;
|
||||||
CreatureUtils.setVelocity(parent, velocity);
|
CreatureUtils.setVelocity(parent, velocity);
|
||||||
if(entityActor != null){
|
if(entityActor != null){
|
||||||
if(sprintTree != null && sprintTree.state == SprintTreeState.SPRINTING){
|
String animationToPlay = determineCorrectAnimation();
|
||||||
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationSprintWindDown)){
|
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationToPlay)){
|
||||||
entityActor.playAnimation(animationSprintWindDown,1);
|
entityActor.playAnimation(animationToPlay,1);
|
||||||
entityActor.incrementAnimationTime(0.01);
|
entityActor.incrementAnimationTime(0.01);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationSlowDown)){
|
|
||||||
entityActor.playAnimation(animationSlowDown,1);
|
|
||||||
entityActor.incrementAnimationTime(0.01);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// if(sprintTree != null && sprintTree.state == SprintTreeState.SPRINTING){
|
||||||
|
// if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationSprintWindDown)){
|
||||||
|
// entityActor.playAnimation(animationSprintWindDown,1);
|
||||||
|
// entityActor.incrementAnimationTime(0.01);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(animationSlowDown)){
|
||||||
|
// entityActor.playAnimation(animationSlowDown,1);
|
||||||
|
// entityActor.incrementAnimationTime(0.01);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
//check if can transition state
|
//check if can transition state
|
||||||
if(velocity <= 0){
|
if(velocity <= 0){
|
||||||
@ -368,7 +427,7 @@ public class GroundMovementTree {
|
|||||||
// }
|
// }
|
||||||
collidable.addImpulse(new Impulse(new Vector3d(movementVector), velocity * Main.deltaTime, "movement"));
|
collidable.addImpulse(new Impulse(new Vector3d(movementVector), velocity * Main.deltaTime, "movement"));
|
||||||
// position.set(newPosition);
|
// position.set(newPosition);
|
||||||
rotation.rotationTo(new Vector3f(0,0,1), new Vector3f((float)movementVector.x,(float)movementVector.y,(float)movementVector.z));
|
rotation.set(movementQuaternion);
|
||||||
|
|
||||||
activateGravityTree();
|
activateGravityTree();
|
||||||
|
|
||||||
@ -485,4 +544,213 @@ public class GroundMovementTree {
|
|||||||
this.sprintTree = sprintTree;
|
this.sprintTree = sprintTree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MovementRelativeFacing getFacing(){
|
||||||
|
return facing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String determineCorrectAnimation(){
|
||||||
|
String rVal = "";
|
||||||
|
if(sprintTree != null){
|
||||||
|
switch(sprintTree.state){
|
||||||
|
case SPRINTING:
|
||||||
|
switch(state){
|
||||||
|
case IDLE:
|
||||||
|
break;
|
||||||
|
case STARTUP:
|
||||||
|
rVal = animationSprintStart;
|
||||||
|
break;
|
||||||
|
case MOVE:
|
||||||
|
rVal = animationSprint;
|
||||||
|
break;
|
||||||
|
case SLOWDOWN:
|
||||||
|
rVal = animationSprintWindDown;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case NOT_SPRINTING:
|
||||||
|
switch(state){
|
||||||
|
case IDLE:
|
||||||
|
break;
|
||||||
|
case STARTUP:
|
||||||
|
switch(facing){
|
||||||
|
case FORWARD:
|
||||||
|
rVal = animationStartUp;
|
||||||
|
break;
|
||||||
|
case BACKWARD:
|
||||||
|
rVal = animationStartUp;
|
||||||
|
break;
|
||||||
|
case LEFT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_LEFT;
|
||||||
|
break;
|
||||||
|
case RIGHT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_RIGHT;
|
||||||
|
break;
|
||||||
|
case FORWARD_LEFT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_LEFT;
|
||||||
|
break;
|
||||||
|
case FORWARD_RIGHT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_RIGHT;
|
||||||
|
break;
|
||||||
|
case BACKWARD_LEFT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_LEFT;
|
||||||
|
break;
|
||||||
|
case BACKWARD_RIGHT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_RIGHT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MOVE:
|
||||||
|
switch(facing){
|
||||||
|
case FORWARD:
|
||||||
|
rVal = animationMain;
|
||||||
|
break;
|
||||||
|
case BACKWARD:
|
||||||
|
rVal = animationMain;
|
||||||
|
break;
|
||||||
|
case LEFT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_LEFT;
|
||||||
|
break;
|
||||||
|
case RIGHT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_RIGHT;
|
||||||
|
break;
|
||||||
|
case FORWARD_LEFT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_LEFT;
|
||||||
|
break;
|
||||||
|
case FORWARD_RIGHT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_RIGHT;
|
||||||
|
break;
|
||||||
|
case BACKWARD_LEFT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_LEFT;
|
||||||
|
break;
|
||||||
|
case BACKWARD_RIGHT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_RIGHT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SLOWDOWN:
|
||||||
|
switch(facing){
|
||||||
|
case FORWARD:
|
||||||
|
rVal = animationSlowDown;
|
||||||
|
break;
|
||||||
|
case BACKWARD:
|
||||||
|
rVal = animationSlowDown;
|
||||||
|
break;
|
||||||
|
case LEFT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_LEFT;
|
||||||
|
break;
|
||||||
|
case RIGHT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_RIGHT;
|
||||||
|
break;
|
||||||
|
case FORWARD_LEFT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_LEFT;
|
||||||
|
break;
|
||||||
|
case FORWARD_RIGHT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_RIGHT;
|
||||||
|
break;
|
||||||
|
case BACKWARD_LEFT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_LEFT;
|
||||||
|
break;
|
||||||
|
case BACKWARD_RIGHT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_RIGHT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch(state){
|
||||||
|
case IDLE:
|
||||||
|
break;
|
||||||
|
case STARTUP:
|
||||||
|
switch(facing){
|
||||||
|
case FORWARD:
|
||||||
|
rVal = animationStartUp;
|
||||||
|
break;
|
||||||
|
case BACKWARD:
|
||||||
|
rVal = animationStartUp;
|
||||||
|
break;
|
||||||
|
case LEFT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_LEFT;
|
||||||
|
break;
|
||||||
|
case RIGHT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_RIGHT;
|
||||||
|
break;
|
||||||
|
case FORWARD_LEFT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_LEFT;
|
||||||
|
break;
|
||||||
|
case FORWARD_RIGHT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_RIGHT;
|
||||||
|
break;
|
||||||
|
case BACKWARD_LEFT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_LEFT;
|
||||||
|
break;
|
||||||
|
case BACKWARD_RIGHT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_RIGHT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MOVE:
|
||||||
|
switch(facing){
|
||||||
|
case FORWARD:
|
||||||
|
rVal = animationMain;
|
||||||
|
break;
|
||||||
|
case BACKWARD:
|
||||||
|
rVal = animationMain;
|
||||||
|
break;
|
||||||
|
case LEFT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_LEFT;
|
||||||
|
break;
|
||||||
|
case RIGHT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_RIGHT;
|
||||||
|
break;
|
||||||
|
case FORWARD_LEFT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_LEFT;
|
||||||
|
break;
|
||||||
|
case FORWARD_RIGHT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_RIGHT;
|
||||||
|
break;
|
||||||
|
case BACKWARD_LEFT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_LEFT;
|
||||||
|
break;
|
||||||
|
case BACKWARD_RIGHT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_RIGHT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SLOWDOWN:
|
||||||
|
switch(facing){
|
||||||
|
case FORWARD:
|
||||||
|
rVal = animationSlowDown;
|
||||||
|
break;
|
||||||
|
case BACKWARD:
|
||||||
|
rVal = animationSlowDown;
|
||||||
|
break;
|
||||||
|
case LEFT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_LEFT;
|
||||||
|
break;
|
||||||
|
case RIGHT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_RIGHT;
|
||||||
|
break;
|
||||||
|
case FORWARD_LEFT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_LEFT;
|
||||||
|
break;
|
||||||
|
case FORWARD_RIGHT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_RIGHT;
|
||||||
|
break;
|
||||||
|
case BACKWARD_LEFT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_LEFT;
|
||||||
|
break;
|
||||||
|
case BACKWARD_RIGHT:
|
||||||
|
rVal = Animation.ANIMATION_WALK_RIGHT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return rVal;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,31 @@
|
|||||||
|
package electrosphere.entity.state.rotator;
|
||||||
|
|
||||||
|
public class RotatorConstraint {
|
||||||
|
|
||||||
|
boolean followsView;
|
||||||
|
boolean followsBone;
|
||||||
|
String parentBone;
|
||||||
|
float allowedMarginPitch;
|
||||||
|
float allowedMarginYaw;
|
||||||
|
|
||||||
|
public boolean getFollowsView(){
|
||||||
|
return followsView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getFollowsBone(){
|
||||||
|
return followsBone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParentBone(){
|
||||||
|
return parentBone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getAllowedMarginPitch(){
|
||||||
|
return allowedMarginPitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getAllowedMarginYaw(){
|
||||||
|
return allowedMarginYaw;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
package electrosphere.entity.state.rotator;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RotatorHierarchyNode {
|
||||||
|
|
||||||
|
String bone;
|
||||||
|
List<RotatorConstraint> rotatorConstraints;
|
||||||
|
List<RotatorHierarchyNode> children;
|
||||||
|
|
||||||
|
public String getBone(){
|
||||||
|
return bone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RotatorConstraint> getRotatorContraints(){
|
||||||
|
return rotatorConstraints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RotatorHierarchyNode> getChildren(){
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addChild(RotatorHierarchyNode child){
|
||||||
|
this.children.add(child);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addRotatorConstraint(RotatorConstraint contraint){
|
||||||
|
this.rotatorConstraints.add(contraint);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBone(String bone){
|
||||||
|
this.bone = bone;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,78 @@
|
|||||||
|
package electrosphere.entity.state.rotator;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.joml.Quaternionf;
|
||||||
|
|
||||||
|
import electrosphere.entity.Entity;
|
||||||
|
import electrosphere.entity.EntityUtils;
|
||||||
|
import electrosphere.renderer.actor.Actor;
|
||||||
|
|
||||||
|
public class RotatorTree {
|
||||||
|
|
||||||
|
public static enum RotatorTreeState {
|
||||||
|
ACTIVE,
|
||||||
|
INACTIVE,
|
||||||
|
}
|
||||||
|
|
||||||
|
RotatorTreeState state;
|
||||||
|
|
||||||
|
Entity parent;
|
||||||
|
Actor entityActor;
|
||||||
|
|
||||||
|
List<RotatorHierarchyNode> rootNodes;
|
||||||
|
|
||||||
|
public RotatorTree(Entity parent){
|
||||||
|
entityActor = EntityUtils.getActor(parent);
|
||||||
|
state = RotatorTreeState.INACTIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActive(boolean isActive){
|
||||||
|
if(isActive){
|
||||||
|
state = RotatorTreeState.ACTIVE;
|
||||||
|
} else {
|
||||||
|
state = RotatorTreeState.INACTIVE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void simulate(){
|
||||||
|
if(entityActor.modelIsLoaded() && this.state == RotatorTreeState.ACTIVE){
|
||||||
|
for(RotatorHierarchyNode node : rootNodes){
|
||||||
|
applyRotatorNode(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void applyRotatorNode(RotatorHierarchyNode node){
|
||||||
|
//apply
|
||||||
|
String nodeBoneName = node.getBone();
|
||||||
|
Quaternionf currentRotation = entityActor.getBoneRotation(nodeBoneName);
|
||||||
|
for(RotatorConstraint constraint : node.getRotatorContraints()){
|
||||||
|
float allowedMarginPitch = constraint.getAllowedMarginPitch();
|
||||||
|
float allowedMarginYaw = constraint.getAllowedMarginYaw();
|
||||||
|
boolean followsBone = constraint.getFollowsBone();
|
||||||
|
boolean followsView = constraint.getFollowsView();
|
||||||
|
if(followsBone){
|
||||||
|
String parentBone = constraint.getParentBone();
|
||||||
|
Quaternionf parentBoneRotation = entityActor.getBoneRotation(parentBone);
|
||||||
|
// currentRotation.
|
||||||
|
}
|
||||||
|
if(followsView){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//recurse to children
|
||||||
|
for(RotatorHierarchyNode child : node.getChildren()){
|
||||||
|
applyRotatorNode(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public float calculateYawOfQuat(Quaternionf quat){
|
||||||
|
return (float)Math.atan2(2.0*(quat.y*quat.z + quat.w*quat.x), quat.w*quat.w - quat.x*quat.x - quat.y*quat.y + quat.z*quat.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float calculatePitchOfQuat(Quaternionf quat){
|
||||||
|
return (float)Math.asin(-2.0*(quat.x*quat.z - quat.w*quat.y));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -54,7 +54,7 @@ public class AttachUtils {
|
|||||||
//set rotation
|
//set rotation
|
||||||
// Quaternionf rotation = parentActor.getBoneRotation(targetBone);
|
// Quaternionf rotation = parentActor.getBoneRotation(targetBone);
|
||||||
// EntityUtils.getRotation(currentEntity).set(rotation).normalize();
|
// EntityUtils.getRotation(currentEntity).set(rotation).normalize();
|
||||||
Vector3d facingAngle = CreatureUtils.getMovementVector(parent);
|
Vector3d facingAngle = CreatureUtils.getFacingVector(parent);
|
||||||
EntityUtils.getRotation(currentEntity).rotationTo(new Vector3f(0,0,1), new Vector3f((float)facingAngle.x,(float)facingAngle.y,(float)facingAngle.z)).mul(parentActor.getBoneRotation(targetBone)).normalize();
|
EntityUtils.getRotation(currentEntity).rotationTo(new Vector3f(0,0,1), new Vector3f((float)facingAngle.x,(float)facingAngle.y,(float)facingAngle.z)).mul(parentActor.getBoneRotation(targetBone)).normalize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -125,7 +125,7 @@ public class CreatureUtils {
|
|||||||
Globals.entityManager.registerSprintableEntity(rVal);
|
Globals.entityManager.registerSprintableEntity(rVal);
|
||||||
}
|
}
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_MOVEMENT_BT, moveTree);
|
rVal.putData(EntityDataStrings.DATA_STRING_MOVEMENT_BT, moveTree);
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_MOVEMENT_VECTOR, new Vector3f(0,0,0));
|
rVal.putData(EntityDataStrings.DATA_STRING_FACING_VECTOR, new Vector3f(0,0,0));
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_MAX_NATURAL_VELOCITY, movementSystem.getMaxVelocity());
|
rVal.putData(EntityDataStrings.DATA_STRING_MAX_NATURAL_VELOCITY, movementSystem.getMaxVelocity());
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_ACCELERATION, movementSystem.getAcceleration());
|
rVal.putData(EntityDataStrings.DATA_STRING_ACCELERATION, movementSystem.getAcceleration());
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_VELOCITY, 0f);
|
rVal.putData(EntityDataStrings.DATA_STRING_VELOCITY, 0f);
|
||||||
@ -179,7 +179,7 @@ public class CreatureUtils {
|
|||||||
Globals.entityManager.registerCreatureEntity(rVal);
|
Globals.entityManager.registerCreatureEntity(rVal);
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_CREATURE_IS_CREATURE, true);
|
rVal.putData(EntityDataStrings.DATA_STRING_CREATURE_IS_CREATURE, true);
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_CREATURE_TYPE, type);
|
rVal.putData(EntityDataStrings.DATA_STRING_CREATURE_TYPE, type);
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_MOVEMENT_VECTOR, new Vector3d(0,0,1));
|
rVal.putData(EntityDataStrings.DATA_STRING_FACING_VECTOR, new Vector3d(0,0,1));
|
||||||
rVal.putData(EntityDataStrings.DRAW_CAST_SHADOW, true);
|
rVal.putData(EntityDataStrings.DRAW_CAST_SHADOW, true);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
@ -196,12 +196,12 @@ public class CreatureUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setMovementVector(Entity e, Vector3d vector){
|
public static void setFacingVector(Entity e, Vector3d vector){
|
||||||
e.putData(EntityDataStrings.DATA_STRING_MOVEMENT_VECTOR, vector);
|
e.putData(EntityDataStrings.DATA_STRING_FACING_VECTOR, vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3d getMovementVector(Entity e){
|
public static Vector3d getFacingVector(Entity e){
|
||||||
return (Vector3d)e.getData(EntityDataStrings.DATA_STRING_MOVEMENT_VECTOR);
|
return (Vector3d)e.getData(EntityDataStrings.DATA_STRING_FACING_VECTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float getAcceleration(Entity e){
|
public static float getAcceleration(Entity e){
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package electrosphere.game.data.creature.type;
|
package electrosphere.game.data.creature.type;
|
||||||
|
|
||||||
import electrosphere.entity.types.hitbox.HitboxData;
|
import electrosphere.entity.types.hitbox.HitboxData;
|
||||||
|
import electrosphere.game.data.creature.type.rotator.RotatorSystem;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class CreatureType {
|
public class CreatureType {
|
||||||
@ -9,6 +11,7 @@ public class CreatureType {
|
|||||||
List<HitboxData> hitboxes;
|
List<HitboxData> hitboxes;
|
||||||
List<String> tokens;
|
List<String> tokens;
|
||||||
List<MovementSystem> movementSystems;
|
List<MovementSystem> movementSystems;
|
||||||
|
RotatorSystem rotatorSystem;
|
||||||
CollidableTemplate collidable;
|
CollidableTemplate collidable;
|
||||||
List<AttackMove> attackMoves;
|
List<AttackMove> attackMoves;
|
||||||
HealthSystem healthSystem;
|
HealthSystem healthSystem;
|
||||||
@ -55,7 +58,9 @@ public class CreatureType {
|
|||||||
return lookAtSystem;
|
return lookAtSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RotatorSystem getRotatorSystem() {
|
||||||
|
return rotatorSystem;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,31 @@
|
|||||||
|
package electrosphere.game.data.creature.type.rotator;
|
||||||
|
|
||||||
|
public class RotatorConstraint {
|
||||||
|
|
||||||
|
boolean followsView;
|
||||||
|
boolean followsBone;
|
||||||
|
String parentBone;
|
||||||
|
float allowedMarginPitch;
|
||||||
|
float allowedMarginYaw;
|
||||||
|
|
||||||
|
public boolean getFollowsView(){
|
||||||
|
return followsView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getFollowsBone(){
|
||||||
|
return followsBone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParentBone(){
|
||||||
|
return parentBone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getAllowedMarginPitch(){
|
||||||
|
return allowedMarginPitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getAllowedMarginYaw(){
|
||||||
|
return allowedMarginYaw;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package electrosphere.game.data.creature.type.rotator;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RotatorItem {
|
||||||
|
String boneName;
|
||||||
|
List<RotatorConstraint> constraints;
|
||||||
|
|
||||||
|
public String getBoneName(){
|
||||||
|
return boneName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RotatorConstraint> getConstraints(){
|
||||||
|
return constraints;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package electrosphere.game.data.creature.type.rotator;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RotatorSystem {
|
||||||
|
List<RotatorItem> rotatorItems;
|
||||||
|
|
||||||
|
public List<RotatorItem> getRotatorItems() {
|
||||||
|
return rotatorItems;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,6 +3,7 @@ package electrosphere.game.server.ai.creature;
|
|||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
import electrosphere.entity.state.movement.GroundMovementTree;
|
import electrosphere.entity.state.movement.GroundMovementTree;
|
||||||
|
import electrosphere.entity.state.movement.GroundMovementTree.MovementRelativeFacing;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.game.server.ai.AI;
|
import electrosphere.game.server.ai.AI;
|
||||||
import electrosphere.main.Globals;
|
import electrosphere.main.Globals;
|
||||||
@ -76,10 +77,10 @@ public class MillAbout extends AI {
|
|||||||
if(moveToTarget){
|
if(moveToTarget){
|
||||||
if(moveTargetPosition.distance(position) > 0.4){
|
if(moveTargetPosition.distance(position) > 0.4){
|
||||||
Vector3d moveVector = new Vector3d(moveTargetPosition).sub(position).normalize();
|
Vector3d moveVector = new Vector3d(moveTargetPosition).sub(position).normalize();
|
||||||
CreatureUtils.setMovementVector(character, new Vector3d((float)moveVector.x,(float)moveVector.y,(float)moveVector.z));
|
CreatureUtils.setFacingVector(character, new Vector3d((float)moveVector.x,(float)moveVector.y,(float)moveVector.z));
|
||||||
GroundMovementTree characterMoveTree = CreatureUtils.getEntityMovementTree(character);
|
GroundMovementTree characterMoveTree = CreatureUtils.getEntityMovementTree(character);
|
||||||
if(characterMoveTree.getState()==GroundMovementTree.MovementTreeState.IDLE || characterMoveTree.getState()==GroundMovementTree.MovementTreeState.SLOWDOWN){
|
if(characterMoveTree.getState()==GroundMovementTree.MovementTreeState.IDLE || characterMoveTree.getState()==GroundMovementTree.MovementTreeState.SLOWDOWN){
|
||||||
characterMoveTree.start();
|
characterMoveTree.start(MovementRelativeFacing.FORWARD);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GroundMovementTree characterMoveTree = CreatureUtils.getEntityMovementTree(character);
|
GroundMovementTree characterMoveTree = CreatureUtils.getEntityMovementTree(character);
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import electrosphere.entity.EntityDataStrings;
|
|||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
import electrosphere.entity.state.AttackTree;
|
import electrosphere.entity.state.AttackTree;
|
||||||
import electrosphere.entity.state.movement.GroundMovementTree;
|
import electrosphere.entity.state.movement.GroundMovementTree;
|
||||||
|
import electrosphere.entity.state.movement.GroundMovementTree.MovementRelativeFacing;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.game.server.ai.AI;
|
import electrosphere.game.server.ai.AI;
|
||||||
import electrosphere.main.Globals;
|
import electrosphere.main.Globals;
|
||||||
@ -69,10 +70,10 @@ public class MindlessAttacker extends AI{
|
|||||||
Vector3d targetPosition = EntityUtils.getPosition(target);
|
Vector3d targetPosition = EntityUtils.getPosition(target);
|
||||||
Vector3d characterPosition = EntityUtils.getPosition(character);
|
Vector3d characterPosition = EntityUtils.getPosition(character);
|
||||||
Vector3d moveVector = new Vector3d(targetPosition).sub(characterPosition).normalize();
|
Vector3d moveVector = new Vector3d(targetPosition).sub(characterPosition).normalize();
|
||||||
CreatureUtils.setMovementVector(character, new Vector3d((float)moveVector.x,(float)moveVector.y,(float)moveVector.z));
|
CreatureUtils.setFacingVector(character, new Vector3d((float)moveVector.x,(float)moveVector.y,(float)moveVector.z));
|
||||||
GroundMovementTree characterMoveTree = CreatureUtils.getEntityMovementTree(character);
|
GroundMovementTree characterMoveTree = CreatureUtils.getEntityMovementTree(character);
|
||||||
if(characterMoveTree.getState()==GroundMovementTree.MovementTreeState.IDLE || characterMoveTree.getState()==GroundMovementTree.MovementTreeState.SLOWDOWN){
|
if(characterMoveTree.getState()==GroundMovementTree.MovementTreeState.IDLE || characterMoveTree.getState()==GroundMovementTree.MovementTreeState.SLOWDOWN){
|
||||||
characterMoveTree.start();
|
characterMoveTree.start(MovementRelativeFacing.FORWARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import electrosphere.entity.EntityUtils;
|
|||||||
import electrosphere.entity.state.AttackTree;
|
import electrosphere.entity.state.AttackTree;
|
||||||
import electrosphere.entity.state.equip.EquipState;
|
import electrosphere.entity.state.equip.EquipState;
|
||||||
import electrosphere.entity.state.movement.GroundMovementTree;
|
import electrosphere.entity.state.movement.GroundMovementTree;
|
||||||
|
import electrosphere.entity.state.movement.GroundMovementTree.MovementRelativeFacing;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.entity.types.item.ItemUtils;
|
import electrosphere.entity.types.item.ItemUtils;
|
||||||
import electrosphere.game.server.ai.AI;
|
import electrosphere.game.server.ai.AI;
|
||||||
@ -161,10 +162,10 @@ public class OpportunisticAttacker extends AI {
|
|||||||
Vector3d targetPosition = EntityUtils.getPosition(target);
|
Vector3d targetPosition = EntityUtils.getPosition(target);
|
||||||
Vector3d characterPosition = EntityUtils.getPosition(character);
|
Vector3d characterPosition = EntityUtils.getPosition(character);
|
||||||
Vector3d moveVector = new Vector3d(targetPosition).sub(characterPosition).normalize();
|
Vector3d moveVector = new Vector3d(targetPosition).sub(characterPosition).normalize();
|
||||||
CreatureUtils.setMovementVector(character, new Vector3d((float)moveVector.x,(float)moveVector.y,(float)moveVector.z));
|
CreatureUtils.setFacingVector(character, new Vector3d((float)moveVector.x,(float)moveVector.y,(float)moveVector.z));
|
||||||
GroundMovementTree characterMoveTree = CreatureUtils.getEntityMovementTree(character);
|
GroundMovementTree characterMoveTree = CreatureUtils.getEntityMovementTree(character);
|
||||||
if(characterMoveTree.getState()==GroundMovementTree.MovementTreeState.IDLE || characterMoveTree.getState()==GroundMovementTree.MovementTreeState.SLOWDOWN){
|
if(characterMoveTree.getState()==GroundMovementTree.MovementTreeState.IDLE || characterMoveTree.getState()==GroundMovementTree.MovementTreeState.SLOWDOWN){
|
||||||
characterMoveTree.start();
|
characterMoveTree.start(MovementRelativeFacing.FORWARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,7 +255,7 @@ public class OpportunisticAttacker extends AI {
|
|||||||
Vector3d targetPosition = EntityUtils.getPosition(target);
|
Vector3d targetPosition = EntityUtils.getPosition(target);
|
||||||
Vector3d movementVector = new Vector3d(targetPosition).sub(position).normalize();
|
Vector3d movementVector = new Vector3d(targetPosition).sub(position).normalize();
|
||||||
Quaternionf movementQuaternion = new Quaternionf().rotationTo(new Vector3f(0,0,1), new Vector3f((float)movementVector.x,0,(float)movementVector.z)).normalize();
|
Quaternionf movementQuaternion = new Quaternionf().rotationTo(new Vector3f(0,0,1), new Vector3f((float)movementVector.x,0,(float)movementVector.z)).normalize();
|
||||||
CreatureUtils.setMovementVector(character, movementVector);
|
CreatureUtils.setFacingVector(character, movementVector);
|
||||||
EntityUtils.getRotation(character).set(movementQuaternion);
|
EntityUtils.getRotation(character).set(movementQuaternion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import electrosphere.renderer.texture.Texture;
|
|||||||
import electrosphere.renderer.texture.TextureMap;
|
import electrosphere.renderer.texture.TextureMap;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import electrosphere.audio.AudioEngine;
|
import electrosphere.audio.AudioEngine;
|
||||||
|
import electrosphere.controls.ControlCallback;
|
||||||
import electrosphere.controls.ControlHandler;
|
import electrosphere.controls.ControlHandler;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityManager;
|
import electrosphere.entity.EntityManager;
|
||||||
@ -118,6 +119,7 @@ public class Globals {
|
|||||||
//
|
//
|
||||||
public static ControlHandler controlHandler;
|
public static ControlHandler controlHandler;
|
||||||
public static boolean updateCamera = true;
|
public static boolean updateCamera = true;
|
||||||
|
public static ControlCallback controlCallback;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@ -103,7 +103,7 @@ public class Main {
|
|||||||
|
|
||||||
public static Entity letterEntity;
|
public static Entity letterEntity;
|
||||||
|
|
||||||
static float targetFrameRate = 1000.0f/144.0f;
|
static float targetFrameRate = 1.0f/144.0f;
|
||||||
|
|
||||||
public static void main(String args[]){
|
public static void main(String args[]){
|
||||||
|
|
||||||
@ -362,7 +362,13 @@ public class Main {
|
|||||||
running = false;
|
running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep((int)(1000.0*Math.max(0.003, deltaTime-targetFrameRate)));
|
// System.out.println(deltaTime + " - " + targetFrameRate);
|
||||||
|
if(deltaTime < targetFrameRate){
|
||||||
|
sleep((int)(1000.0 * (targetFrameRate - deltaTime)));
|
||||||
|
} else {
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
// sleep((int)(1000.0*Math.max(0.001, deltaTime-targetFrameRate)));
|
||||||
}
|
}
|
||||||
//Terminate the program.
|
//Terminate the program.
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package electrosphere.renderer;
|
package electrosphere.renderer;
|
||||||
|
|
||||||
|
import electrosphere.controls.ControlCallback;
|
||||||
import electrosphere.entity.CameraEntityUtils;
|
import electrosphere.entity.CameraEntityUtils;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityDataStrings;
|
import electrosphere.entity.EntityDataStrings;
|
||||||
@ -30,6 +31,8 @@ import org.joml.Vector3d;
|
|||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
import org.lwjgl.BufferUtils;
|
import org.lwjgl.BufferUtils;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
import org.lwjgl.glfw.GLFWKeyCallback;
|
||||||
|
|
||||||
import static org.lwjgl.glfw.GLFW.GLFW_CONTEXT_VERSION_MAJOR;
|
import static org.lwjgl.glfw.GLFW.GLFW_CONTEXT_VERSION_MAJOR;
|
||||||
import static org.lwjgl.glfw.GLFW.GLFW_CONTEXT_VERSION_MINOR;
|
import static org.lwjgl.glfw.GLFW.GLFW_CONTEXT_VERSION_MINOR;
|
||||||
import static org.lwjgl.glfw.GLFW.GLFW_CURSOR;
|
import static org.lwjgl.glfw.GLFW.GLFW_CURSOR;
|
||||||
@ -156,6 +159,10 @@ public class RenderingEngine {
|
|||||||
Globals.WINDOW_WIDTH = bufferWidth;
|
Globals.WINDOW_WIDTH = bufferWidth;
|
||||||
Globals.WINDOW_HEIGHT = bufferHeight;
|
Globals.WINDOW_HEIGHT = bufferHeight;
|
||||||
|
|
||||||
|
//set key callback
|
||||||
|
Globals.controlCallback = new ControlCallback();
|
||||||
|
GLFW.glfwSetKeyCallback(Globals.window, Globals.controlCallback);
|
||||||
|
|
||||||
//get title bar dimensions
|
//get title bar dimensions
|
||||||
// setTitleBarDimensions();
|
// setTitleBarDimensions();
|
||||||
|
|
||||||
|
|||||||
@ -280,6 +280,15 @@ public class Actor {
|
|||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean modelIsLoaded(){
|
||||||
|
Model model = Globals.assetManager.fetchModel(modelPath);
|
||||||
|
if(model != null){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setTextureOverride(String override){
|
public void setTextureOverride(String override){
|
||||||
textureOverride = override;
|
textureOverride = override;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,8 @@ public class Animation {
|
|||||||
public static final String ANIMATION_SPRINT_STARTUP = "Armature|RunStart";
|
public static final String ANIMATION_SPRINT_STARTUP = "Armature|RunStart";
|
||||||
public static final String ANIMATION_SPRINT = "Armature|Run";
|
public static final String ANIMATION_SPRINT = "Armature|Run";
|
||||||
public static final String ANIMATION_SPRINT_WINDDOWN = "Armature|RunStart";
|
public static final String ANIMATION_SPRINT_WINDDOWN = "Armature|RunStart";
|
||||||
|
public static final String ANIMATION_WALK_RIGHT = "Armature|JogRight";
|
||||||
|
public static final String ANIMATION_WALK_LEFT = "Armature|JogLeft";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -69,7 +71,7 @@ public class Animation {
|
|||||||
//Read in anim channels (bone modifications)
|
//Read in anim channels (bone modifications)
|
||||||
//
|
//
|
||||||
int channelCount = animData.mNumChannels();
|
int channelCount = animData.mNumChannels();
|
||||||
channels = new ArrayList();
|
channels = new ArrayList<AnimChannel>();
|
||||||
if(channelCount > 0){
|
if(channelCount > 0){
|
||||||
// System.out.println("Channel count: " + channelCount);
|
// System.out.println("Channel count: " + channelCount);
|
||||||
for(int i = 0; i < channelCount; i++){
|
for(int i = 0; i < channelCount; i++){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user