Rotation tree
This commit is contained in:
parent
f5790b6947
commit
5be3c9c2d5
@ -124,10 +124,10 @@ public class ControlHandler {
|
|||||||
*/
|
*/
|
||||||
handler.addControl(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD, new Control(true,false,GLFW_KEY_W));
|
handler.addControl(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD, new Control(true,false,GLFW_KEY_W));
|
||||||
handler.addControl(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD, new Control(true,false,GLFW_KEY_S));
|
handler.addControl(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD, new Control(true,false,GLFW_KEY_S));
|
||||||
handler.addControl(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT, new Control(true,false,GLFW_KEY_F24));
|
handler.addControl(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT, new Control(true,false,GLFW_KEY_A));
|
||||||
handler.addControl(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT, new Control(true,false,GLFW_KEY_F24));
|
handler.addControl(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT, new Control(true,false,GLFW_KEY_D));
|
||||||
handler.addControl(DATA_STRING_INPUT_CODE_STRAFE_LEFT, new Control(true,false,GLFW_KEY_A));
|
handler.addControl(DATA_STRING_INPUT_CODE_STRAFE_LEFT, new Control(true,false,GLFW_KEY_F24));
|
||||||
handler.addControl(DATA_STRING_INPUT_CODE_STRAFE_RIGHT, new Control(true,false,GLFW_KEY_D));
|
handler.addControl(DATA_STRING_INPUT_CODE_STRAFE_RIGHT, new Control(true,false,GLFW_KEY_F24));
|
||||||
handler.addControl(DATA_STRING_INPUT_CODE_MOVEMENT_JUMP, new Control(true,false,GLFW_KEY_SPACE));
|
handler.addControl(DATA_STRING_INPUT_CODE_MOVEMENT_JUMP, new Control(true,false,GLFW_KEY_SPACE));
|
||||||
handler.addControl(DATA_STRING_INPUT_CODE_MOVEMENT_FALL, new Control(true,false,GLFW_KEY_LEFT_CONTROL));
|
handler.addControl(DATA_STRING_INPUT_CODE_MOVEMENT_FALL, new Control(true,false,GLFW_KEY_LEFT_CONTROL));
|
||||||
handler.addControl(DATA_STRING_INPUT_CODE_ATTACK_PRIMARY, new Control(false,true,GLFW_MOUSE_BUTTON_LEFT));
|
handler.addControl(DATA_STRING_INPUT_CODE_ATTACK_PRIMARY, new Control(false,true,GLFW_MOUSE_BUTTON_LEFT));
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import electrosphere.controls.ControlHandler;
|
|||||||
import electrosphere.entity.CameraEntityUtils;
|
import electrosphere.entity.CameraEntityUtils;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
|
import electrosphere.entity.state.ApplyRotationTree;
|
||||||
import electrosphere.game.collision.CollisionEngine;
|
import electrosphere.game.collision.CollisionEngine;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.entity.types.item.ItemUtils;
|
import electrosphere.entity.types.item.ItemUtils;
|
||||||
@ -522,9 +523,11 @@ public class LoadingThread extends Thread {
|
|||||||
Globals.skyboxColors.add(new Vector3f(groundR,groundG,groundB));
|
Globals.skyboxColors.add(new Vector3f(groundR,groundG,groundB));
|
||||||
Globals.skyboxColors.add(new Vector3f(groundR,groundG,groundB));
|
Globals.skyboxColors.add(new Vector3f(groundR,groundG,groundB));
|
||||||
|
|
||||||
|
//cloud ring pseudo skybox
|
||||||
Entity cloudRing = EntityUtils.spawnDrawableEntity("Models/cloudRing.fbx");
|
Entity cloudRing = EntityUtils.spawnDrawableEntity("Models/cloudRing.fbx");
|
||||||
EntityUtils.getRotation(cloudRing).rotateX((float)(-Math.PI/2.0f));
|
EntityUtils.getRotation(cloudRing).rotateX((float)(-Math.PI/2.0f));
|
||||||
EntityUtils.getScale(cloudRing).mul(1000.0f);
|
EntityUtils.getScale(cloudRing).mul(1000.0f);
|
||||||
|
Globals.entityManager.registerBehaviorTree(new ApplyRotationTree(cloudRing,new Quaternionf().rotationZ(0.0001f)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -157,6 +157,20 @@ public class EntityManager {
|
|||||||
public CopyOnWriteArrayList<Entity> getSprintables(){
|
public CopyOnWriteArrayList<Entity> getSprintables(){
|
||||||
return sprintableList;
|
return sprintableList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void registerBehaviorTree(BehaviorTree tree){
|
||||||
|
behaviorTreeList.add(tree);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeBehaviorTree(BehaviorTree tree){
|
||||||
|
behaviorTreeList.remove(tree);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void simulateBehaviorTrees(){
|
||||||
|
for(BehaviorTree tree : behaviorTreeList){
|
||||||
|
tree.simulate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void deregisterEntity(Entity e){
|
public void deregisterEntity(Entity e){
|
||||||
if(lightList.contains(e)){
|
if(lightList.contains(e)){
|
||||||
|
|||||||
@ -16,7 +16,7 @@ public class ApplyRotationTree implements BehaviorTree {
|
|||||||
|
|
||||||
Quaternionf rotationToApply;
|
Quaternionf rotationToApply;
|
||||||
Entity parent;
|
Entity parent;
|
||||||
ApplyRotationTreeState state;
|
ApplyRotationTreeState state = ApplyRotationTreeState.ROTATE;
|
||||||
|
|
||||||
public ApplyRotationTree(Entity parent, Quaternionf rotationToApply){
|
public ApplyRotationTree(Entity parent, Quaternionf rotationToApply){
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
@ -35,7 +35,7 @@ public class ApplyRotationTree implements BehaviorTree {
|
|||||||
public void simulate(){
|
public void simulate(){
|
||||||
switch(state){
|
switch(state){
|
||||||
case ROTATE:
|
case ROTATE:
|
||||||
EntityUtils.getRotation(parent).slerp(rotationToApply, 1.0f);
|
EntityUtils.getRotation(parent).mul(rotationToApply).normalize();
|
||||||
break;
|
break;
|
||||||
case NO_ROTATE:
|
case NO_ROTATE:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -123,6 +123,8 @@ public class MicroSimulation {
|
|||||||
if(Globals.RUN_CLIENT){
|
if(Globals.RUN_CLIENT){
|
||||||
Globals.entityManager.clearOutOfBoundsEntities();
|
Globals.entityManager.clearOutOfBoundsEntities();
|
||||||
}
|
}
|
||||||
|
//simulate behavior trees
|
||||||
|
Globals.entityManager.simulateBehaviorTrees();
|
||||||
//data cell manager update
|
//data cell manager update
|
||||||
if(Globals.dataCellManager != null){
|
if(Globals.dataCellManager != null){
|
||||||
boolean playerHasChangedChunk = Globals.dataCellManager.updatePlayerPositions();
|
boolean playerHasChangedChunk = Globals.dataCellManager.updatePlayerPositions();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user