Add goblins
This commit is contained in:
parent
5eae8dee7a
commit
1c01ab1868
@ -82,6 +82,15 @@
|
|||||||
"radius": 0.04
|
"radius": 0.04
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id" : 3,
|
||||||
|
"isCreature" : true,
|
||||||
|
"isItem" : false,
|
||||||
|
"modelPath" : "Models/goblin1.fbx",
|
||||||
|
"hitboxes" : [
|
||||||
|
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
assets/Models/goblin1.fbx
Normal file
BIN
assets/Models/goblin1.fbx
Normal file
Binary file not shown.
BIN
assets/Textures/GoblinEyes.png
Normal file
BIN
assets/Textures/GoblinEyes.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 143 KiB |
BIN
assets/Textures/GoblinSkin.png
Normal file
BIN
assets/Textures/GoblinSkin.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 89 KiB |
@ -45,6 +45,16 @@
|
|||||||
"/Textures/Branch.png",
|
"/Textures/Branch.png",
|
||||||
"/Textures/Branch.png"
|
"/Textures/Branch.png"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"Models/goblin1.fbx" : {
|
||||||
|
"makehuman1" : [
|
||||||
|
"/Textures/GoblinSkin.png",
|
||||||
|
"/Textures/GoblinSkin.png"
|
||||||
|
],
|
||||||
|
"high-poly" : [
|
||||||
|
"/Textures/GoblinEyes.png",
|
||||||
|
"/Textures/GoblinEyes.png"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -322,13 +322,13 @@ public class ControlHandler {
|
|||||||
Move up
|
Move up
|
||||||
*/
|
*/
|
||||||
if(controlsMap.containsKey(DATA_STRING_INPUT_CODE_MOVEMENT_JUMP) && glfwGetKey(Globals.window, controlsMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_JUMP)) == GLFW_PRESS){
|
if(controlsMap.containsKey(DATA_STRING_INPUT_CODE_MOVEMENT_JUMP) && glfwGetKey(Globals.window, controlsMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_JUMP)) == GLFW_PRESS){
|
||||||
EntityUtils.getEntityPosition(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(controlsMap.containsKey(DATA_STRING_INPUT_CODE_MOVEMENT_FALL) && glfwGetKey(Globals.window, controlsMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FALL)) == GLFW_PRESS){
|
if(controlsMap.containsKey(DATA_STRING_INPUT_CODE_MOVEMENT_FALL) && glfwGetKey(Globals.window, controlsMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FALL)) == GLFW_PRESS){
|
||||||
EntityUtils.getEntityPosition(Globals.playerCharacter).add(new Vector3f(0,-0.6f,0).mul(1f));
|
EntityUtils.getPosition(Globals.playerCharacter).add(new Vector3f(0,-0.6f,0).mul(1f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import electrosphere.game.collision.CommonWorldData;
|
|||||||
import electrosphere.game.state.MacroSimulation;
|
import electrosphere.game.state.MacroSimulation;
|
||||||
import electrosphere.game.server.terrain.manager.ServerTerrainManager;
|
import electrosphere.game.server.terrain.manager.ServerTerrainManager;
|
||||||
import electrosphere.game.server.world.ServerWorldData;
|
import electrosphere.game.server.world.ServerWorldData;
|
||||||
import electrosphere.game.state.AttachUtils;
|
import electrosphere.entity.types.attach.AttachUtils;
|
||||||
import electrosphere.game.state.MicroSimulation;
|
import electrosphere.game.state.MicroSimulation;
|
||||||
import electrosphere.logger.LoggerInterface;
|
import electrosphere.logger.LoggerInterface;
|
||||||
import electrosphere.main.Globals;
|
import electrosphere.main.Globals;
|
||||||
@ -393,7 +393,7 @@ public class LoadingThread extends Thread {
|
|||||||
*/
|
*/
|
||||||
Model skyboxModel = Globals.assetManager.fetchModel(AssetDataStrings.ASSET_STRING_SKYBOX_BASIC);
|
Model skyboxModel = Globals.assetManager.fetchModel(AssetDataStrings.ASSET_STRING_SKYBOX_BASIC);
|
||||||
Entity skyboxEntity = EntityUtils.spawnDrawableEntity(AssetDataStrings.ASSET_STRING_SKYBOX_BASIC);
|
Entity skyboxEntity = EntityUtils.spawnDrawableEntity(AssetDataStrings.ASSET_STRING_SKYBOX_BASIC);
|
||||||
EntityUtils.getEntityScale(skyboxEntity).mul(100);
|
EntityUtils.getScale(skyboxEntity).mul(100);
|
||||||
|
|
||||||
|
|
||||||
Globals.skyboxColors.add(new Vector3f(100,150,200));
|
Globals.skyboxColors.add(new Vector3f(100,150,200));
|
||||||
@ -465,14 +465,18 @@ public class LoadingThread extends Thread {
|
|||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
String treePath = "Models/tree1.fbx";
|
String treePath = "Models/tree1.fbx";
|
||||||
Entity tree = EntityUtils.spawnDrawableEntity(treePath);
|
Entity tree = EntityUtils.spawnDrawableEntity(treePath);
|
||||||
EntityUtils.getEntityPosition(tree).set(rand.nextFloat() * 150 + 10, 0, rand.nextFloat() * 150 + 10);
|
EntityUtils.getPosition(tree).set(rand.nextFloat() * 150 + 10, 0, rand.nextFloat() * 150 + 10);
|
||||||
// EntityUtils.getEntityRotation(tree).rotateAxis((float)-Math.PI/2.0f, new Vector3f(1,0,0));
|
// EntityUtils.getEntityRotation(tree).rotateAxis((float)-Math.PI/2.0f, new Vector3f(1,0,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Entity goblin = EntityUtils.spawnEntityFromEntityMap(3);
|
||||||
|
EntityUtils.getPosition(goblin).set(5, 0, 3);
|
||||||
|
EntityUtils.getScale(goblin).set(0.005f);
|
||||||
|
|
||||||
Entity sword = ItemUtils.spawnBasicItem(2);
|
Entity sword = ItemUtils.spawnBasicItem(2);
|
||||||
Entity testHomie = CreatureUtils.spawnBasicCreature(0, 0.1f, 0.5f);
|
Entity testHomie = CreatureUtils.spawnBasicCreature(0, 0.1f, 0.5f);
|
||||||
EntityUtils.getEntityScale(testHomie).set(0.005f);
|
EntityUtils.getScale(testHomie).set(0.005f);
|
||||||
EntityUtils.getEntityPosition(testHomie).set(2,0,2);
|
EntityUtils.getPosition(testHomie).set(2,0,2);
|
||||||
AttachUtils.attachEntityToEntityAtBone(testHomie, sword, "Bone.020");
|
AttachUtils.attachEntityToEntityAtBone(testHomie, sword, "Bone.020");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,19 +22,19 @@ import org.joml.Vector3f;
|
|||||||
*/
|
*/
|
||||||
public class EntityUtils {
|
public class EntityUtils {
|
||||||
|
|
||||||
public static Vector3f getEntityPosition(Entity e){
|
public static Vector3f getPosition(Entity e){
|
||||||
return (Vector3f)e.getData(EntityDataStrings.DATA_STRING_POSITION);
|
return (Vector3f)e.getData(EntityDataStrings.DATA_STRING_POSITION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Quaternionf getEntityRotation(Entity e){
|
public static Quaternionf getRotation(Entity e){
|
||||||
return (Quaternionf)e.getData(EntityDataStrings.DATA_STRING_ROTATION);
|
return (Quaternionf)e.getData(EntityDataStrings.DATA_STRING_ROTATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3f getEntityScale(Entity e){
|
public static Vector3f getScale(Entity e){
|
||||||
return (Vector3f)e.getData(EntityDataStrings.DATA_STRING_SCALE);
|
return (Vector3f)e.getData(EntityDataStrings.DATA_STRING_SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getEntityModelPath(Entity e){
|
public static String getModelPath(Entity e){
|
||||||
return (String)e.getData(EntityDataStrings.DATA_STRING_MODEL_PATH);
|
return (String)e.getData(EntityDataStrings.DATA_STRING_MODEL_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ public class EntityUtils {
|
|||||||
Globals.entityManager.overrideEntityId(e, id);
|
Globals.entityManager.overrideEntityId(e, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Actor getEntityActor(Entity e){
|
public static Actor getActor(Entity e){
|
||||||
return (Actor)e.getData(EntityDataStrings.DATA_STRING_ACTOR);
|
return (Actor)e.getData(EntityDataStrings.DATA_STRING_ACTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -66,9 +66,9 @@ public class MovementTree {
|
|||||||
float velocity = CreatureUtils.getVelocity(parent);
|
float velocity = CreatureUtils.getVelocity(parent);
|
||||||
float acceleration = CreatureUtils.getAcceleration(parent);
|
float acceleration = CreatureUtils.getAcceleration(parent);
|
||||||
float maxNaturalVelocity = CreatureUtils.getMaxNaturalVelocity(parent);
|
float maxNaturalVelocity = CreatureUtils.getMaxNaturalVelocity(parent);
|
||||||
Actor entityActor = EntityUtils.getEntityActor(parent);
|
Actor entityActor = EntityUtils.getActor(parent);
|
||||||
// Model entityModel = Globals.assetManager.fetchModel(EntityUtils.getEntityModelPath(parent));
|
// Model entityModel = Globals.assetManager.fetchModel(EntityUtils.getEntityModelPath(parent));
|
||||||
Vector3f position = EntityUtils.getEntityPosition(parent);
|
Vector3f position = EntityUtils.getPosition(parent);
|
||||||
Vector3f movementVector = CreatureUtils.getMovementVector(parent);
|
Vector3f movementVector = CreatureUtils.getMovementVector(parent);
|
||||||
Vector3f newPosition;
|
Vector3f newPosition;
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ public class MovementTree {
|
|||||||
}
|
}
|
||||||
// System.out.println(EntityUtils.getEntityPosition(parent));
|
// System.out.println(EntityUtils.getEntityPosition(parent));
|
||||||
// System.out.println(message.getpositionX() + " " + message.getpositionY() + " " + message.getpositionZ());
|
// System.out.println(message.getpositionX() + " " + message.getpositionY() + " " + message.getpositionZ());
|
||||||
EntityUtils.getEntityPosition(parent).set(message.getpositionX(),message.getpositionY(),message.getpositionZ());
|
EntityUtils.getPosition(parent).set(message.getpositionX(),message.getpositionY(),message.getpositionZ());
|
||||||
CreatureUtils.setMovementVector(parent, new Vector3f(message.getrotationX(),message.getrotationY(),message.getrotationZ()));
|
CreatureUtils.setMovementVector(parent, new Vector3f(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();
|
||||||
@ -146,8 +146,8 @@ public class MovementTree {
|
|||||||
newPosition = Globals.collisionEngine.suggestMovementPosition(Globals.commonWorldData, parent, newPosition);
|
newPosition = Globals.collisionEngine.suggestMovementPosition(Globals.commonWorldData, parent, newPosition);
|
||||||
}
|
}
|
||||||
//actually update
|
//actually update
|
||||||
EntityUtils.getEntityPosition(parent).set(newPosition);
|
EntityUtils.getPosition(parent).set(newPosition);
|
||||||
EntityUtils.getEntityRotation(parent).rotationTo(new Vector3f(0,0,1), movementVector);
|
EntityUtils.getRotation(parent).rotationTo(new Vector3f(0,0,1), movementVector);
|
||||||
if(Globals.RUN_SERVER){
|
if(Globals.RUN_SERVER){
|
||||||
Globals.server.broadcastMessage(
|
Globals.server.broadcastMessage(
|
||||||
EntityMessage.constructmoveUpdateMessage(
|
EntityMessage.constructmoveUpdateMessage(
|
||||||
@ -195,8 +195,8 @@ public class MovementTree {
|
|||||||
if(!Globals.collisionEngine.checkCanOccupyPosition(Globals.commonWorldData, parent, newPosition)){
|
if(!Globals.collisionEngine.checkCanOccupyPosition(Globals.commonWorldData, parent, newPosition)){
|
||||||
newPosition = Globals.collisionEngine.suggestMovementPosition(Globals.commonWorldData, parent, newPosition);
|
newPosition = Globals.collisionEngine.suggestMovementPosition(Globals.commonWorldData, parent, newPosition);
|
||||||
}
|
}
|
||||||
EntityUtils.getEntityPosition(parent).set(newPosition);
|
EntityUtils.getPosition(parent).set(newPosition);
|
||||||
EntityUtils.getEntityRotation(parent).rotationTo(new Vector3f(0,0,1), movementVector);
|
EntityUtils.getRotation(parent).rotationTo(new Vector3f(0,0,1), movementVector);
|
||||||
if(Globals.RUN_SERVER){
|
if(Globals.RUN_SERVER){
|
||||||
Globals.server.broadcastMessage(
|
Globals.server.broadcastMessage(
|
||||||
EntityMessage.constructmoveUpdateMessage(
|
EntityMessage.constructmoveUpdateMessage(
|
||||||
@ -249,8 +249,8 @@ public class MovementTree {
|
|||||||
if(!Globals.collisionEngine.checkCanOccupyPosition(Globals.commonWorldData, parent, newPosition)){
|
if(!Globals.collisionEngine.checkCanOccupyPosition(Globals.commonWorldData, parent, newPosition)){
|
||||||
newPosition = Globals.collisionEngine.suggestMovementPosition(Globals.commonWorldData, parent, newPosition);
|
newPosition = Globals.collisionEngine.suggestMovementPosition(Globals.commonWorldData, parent, newPosition);
|
||||||
}
|
}
|
||||||
EntityUtils.getEntityPosition(parent).set(newPosition);
|
EntityUtils.getPosition(parent).set(newPosition);
|
||||||
EntityUtils.getEntityRotation(parent).rotationTo(new Vector3f(0,0,1), movementVector);
|
EntityUtils.getRotation(parent).rotationTo(new Vector3f(0,0,1), movementVector);
|
||||||
if(Globals.RUN_SERVER){
|
if(Globals.RUN_SERVER){
|
||||||
Globals.server.broadcastMessage(
|
Globals.server.broadcastMessage(
|
||||||
EntityMessage.constructmoveUpdateMessage(
|
EntityMessage.constructmoveUpdateMessage(
|
||||||
@ -291,7 +291,7 @@ public class MovementTree {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(Globals.collisionEngine.gravityCheck(Globals.commonWorldData, parent)){
|
if(Globals.collisionEngine.gravityCheck(Globals.commonWorldData, parent)){
|
||||||
EntityUtils.getEntityPosition(parent).set(Globals.collisionEngine.suggestMovementPosition(Globals.commonWorldData,parent,new Vector3f(position.x,position.y - 9.8f,position.z)));
|
EntityUtils.getPosition(parent).set(Globals.collisionEngine.suggestMovementPosition(Globals.commonWorldData,parent,new Vector3f(position.x,position.y - 9.8f,position.z)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package electrosphere.game.state;
|
package electrosphere.entity.types.attach;
|
||||||
|
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityDataStrings;
|
import electrosphere.entity.EntityDataStrings;
|
||||||
@ -28,13 +28,13 @@ public class AttachUtils {
|
|||||||
if((parent = (Entity)currentEntity.getData(EntityDataStrings.ATTACH_PARENT))!=null){
|
if((parent = (Entity)currentEntity.getData(EntityDataStrings.ATTACH_PARENT))!=null){
|
||||||
String targetBone;
|
String targetBone;
|
||||||
if((targetBone = (String)currentEntity.getData(EntityDataStrings.ATTACH_TARGET_BONE))!=null){
|
if((targetBone = (String)currentEntity.getData(EntityDataStrings.ATTACH_TARGET_BONE))!=null){
|
||||||
Actor parentActor = EntityUtils.getEntityActor(parent);
|
Actor parentActor = EntityUtils.getActor(parent);
|
||||||
Vector3f position = new Vector3f(parentActor.getBonePosition(targetBone));
|
Vector3f position = new Vector3f(parentActor.getBonePosition(targetBone));
|
||||||
position = position.mul(((Vector3f)EntityUtils.getEntityScale(parent)));
|
position = position.mul(((Vector3f)EntityUtils.getScale(parent)));
|
||||||
position = position.rotate(((Quaternionf)EntityUtils.getEntityRotation(parent)));
|
position = position.rotate(((Quaternionf)EntityUtils.getRotation(parent)));
|
||||||
position.add(new Vector3f(EntityUtils.getEntityPosition(parent)));
|
position.add(new Vector3f(EntityUtils.getPosition(parent)));
|
||||||
EntityUtils.getEntityPosition(currentEntity).set(position);
|
EntityUtils.getPosition(currentEntity).set(position);
|
||||||
EntityUtils.getEntityRotation(currentEntity).set(EntityUtils.getEntityRotation(parent)).normalize();
|
EntityUtils.getRotation(currentEntity).set(EntityUtils.getRotation(parent)).normalize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -41,10 +41,10 @@ public class HitboxUtils {
|
|||||||
public static void updatePosition(Entity hitbox){
|
public static void updatePosition(Entity hitbox){
|
||||||
Entity parent = ((Entity)hitbox.getData(EntityDataStrings.COLLISION_ENTITY_DATA_PARENT));
|
Entity parent = ((Entity)hitbox.getData(EntityDataStrings.COLLISION_ENTITY_DATA_PARENT));
|
||||||
String boneName = ((String)(hitbox.getData(EntityDataStrings.COLLISION_ENTITY_DATA_BONE)));
|
String boneName = ((String)(hitbox.getData(EntityDataStrings.COLLISION_ENTITY_DATA_BONE)));
|
||||||
Quaternionf parentRotation = ((Quaternionf)EntityUtils.getEntityRotation(parent));
|
Quaternionf parentRotation = ((Quaternionf)EntityUtils.getRotation(parent));
|
||||||
Vector3f positionScale = ((Vector3f)EntityUtils.getEntityScale(parent));
|
Vector3f positionScale = ((Vector3f)EntityUtils.getScale(parent));
|
||||||
Vector3f worldPosition = new Vector3f();
|
Vector3f worldPosition = new Vector3f();
|
||||||
Vector3f bonePosition = EntityUtils.getEntityActor(parent).getBonePosition(boneName);
|
Vector3f bonePosition = EntityUtils.getActor(parent).getBonePosition(boneName);
|
||||||
worldPosition.set(bonePosition.x,bonePosition.y,bonePosition.z);
|
worldPosition.set(bonePosition.x,bonePosition.y,bonePosition.z);
|
||||||
Quaternionf rotation = new Quaternionf(parentRotation);
|
Quaternionf rotation = new Quaternionf(parentRotation);
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ public class HitboxUtils {
|
|||||||
worldPosition = worldPosition.rotate(rotation);
|
worldPosition = worldPosition.rotate(rotation);
|
||||||
|
|
||||||
|
|
||||||
worldPosition.add(EntityUtils.getEntityPosition(parent));
|
worldPosition.add(EntityUtils.getPosition(parent));
|
||||||
|
|
||||||
((Vector3f)hitbox.getData(EntityDataStrings.DATA_STRING_POSITION)).set(worldPosition);
|
((Vector3f)hitbox.getData(EntityDataStrings.DATA_STRING_POSITION)).set(worldPosition);
|
||||||
}
|
}
|
||||||
@ -74,9 +74,9 @@ public class HitboxUtils {
|
|||||||
){
|
){
|
||||||
if(generatorType.equals(EntityDataStrings.COLLISION_ENTITY_DATA_TYPE_HURT)){
|
if(generatorType.equals(EntityDataStrings.COLLISION_ENTITY_DATA_TYPE_HURT)){
|
||||||
// Globals.microSimulation.freeze();
|
// Globals.microSimulation.freeze();
|
||||||
EntityUtils.getEntityPosition(generatorParent).set(Globals.spawnPoint);
|
EntityUtils.getPosition(generatorParent).set(Globals.spawnPoint);
|
||||||
} else if(receiverParent.equals(EntityDataStrings.COLLISION_ENTITY_DATA_TYPE_HURT)){
|
} else if(receiverParent.equals(EntityDataStrings.COLLISION_ENTITY_DATA_TYPE_HURT)){
|
||||||
EntityUtils.getEntityPosition(receiverParent).set(Globals.spawnPoint);
|
EntityUtils.getPosition(receiverParent).set(Globals.spawnPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ public class ItemUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void updateItemActorAnimation(Entity item){
|
public static void updateItemActorAnimation(Entity item){
|
||||||
Actor actor = EntityUtils.getEntityActor(item);
|
Actor actor = EntityUtils.getActor(item);
|
||||||
if(actor.getCurrentAnimation() == null){
|
if(actor.getCurrentAnimation() == null){
|
||||||
// Model model;
|
// Model model;
|
||||||
// if((model = Globals.assetManager.fetchModel(actor.getModelPath()))!=null){
|
// if((model = Globals.assetManager.fetchModel(actor.getModelPath()))!=null){
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package electrosphere.game.state;
|
package electrosphere.entity.types.life;
|
||||||
|
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -78,7 +78,7 @@ public class DrawCell {
|
|||||||
String terrainModelPath = Globals.assetManager.registerModel(terrainModel);
|
String terrainModelPath = Globals.assetManager.registerModel(terrainModel);
|
||||||
modelEntity = EntityUtils.spawnDrawableEntity(terrainModelPath);
|
modelEntity = EntityUtils.spawnDrawableEntity(terrainModelPath);
|
||||||
LoggerInterface.loggerRenderer.INFO("New cell @ " + cellX * dynamicInterpolationRatio + "," + cellY * dynamicInterpolationRatio);
|
LoggerInterface.loggerRenderer.INFO("New cell @ " + cellX * dynamicInterpolationRatio + "," + cellY * dynamicInterpolationRatio);
|
||||||
EntityUtils.getEntityPosition(modelEntity).set(new Vector3f(cellX * dynamicInterpolationRatio, 0.01f, cellY * dynamicInterpolationRatio));
|
EntityUtils.getPosition(modelEntity).set(new Vector3f(cellX * dynamicInterpolationRatio, 0.01f, cellY * dynamicInterpolationRatio));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void retireCell(){
|
public void retireCell(){
|
||||||
|
|||||||
@ -95,8 +95,8 @@ public class CollisionEngine {
|
|||||||
|
|
||||||
|
|
||||||
public boolean collisionSphereCheck(Entity hitbox1, Entity hitbox2){
|
public boolean collisionSphereCheck(Entity hitbox1, Entity hitbox2){
|
||||||
Vector3f position1 = EntityUtils.getEntityPosition(hitbox1);
|
Vector3f position1 = EntityUtils.getPosition(hitbox1);
|
||||||
Vector3f position2 = EntityUtils.getEntityPosition(hitbox2);
|
Vector3f position2 = EntityUtils.getPosition(hitbox2);
|
||||||
float radius1 = (float)hitbox1.getData(EntityDataStrings.COLLISION_ENTITY_DATA_RADIUS);
|
float radius1 = (float)hitbox1.getData(EntityDataStrings.COLLISION_ENTITY_DATA_RADIUS);
|
||||||
float radius2 = (float)hitbox2.getData(EntityDataStrings.COLLISION_ENTITY_DATA_RADIUS);
|
float radius2 = (float)hitbox2.getData(EntityDataStrings.COLLISION_ENTITY_DATA_RADIUS);
|
||||||
float distance = position1.distance(position2);
|
float distance = position1.distance(position2);
|
||||||
@ -111,8 +111,8 @@ public class CollisionEngine {
|
|||||||
Check if the entity is being accelerated by gravity
|
Check if the entity is being accelerated by gravity
|
||||||
*/
|
*/
|
||||||
public boolean gravityCheck(CommonWorldData w, Entity e){
|
public boolean gravityCheck(CommonWorldData w, Entity e){
|
||||||
float worldHeight = w.getElevationAtPoint(EntityUtils.getEntityPosition(e));
|
float worldHeight = w.getElevationAtPoint(EntityUtils.getPosition(e));
|
||||||
float entityHeight = EntityUtils.getEntityPosition(e).y;
|
float entityHeight = EntityUtils.getPosition(e).y;
|
||||||
return entityHeight > worldHeight + 0.1f;
|
return entityHeight > worldHeight + 0.1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package electrosphere.game.state;
|
package electrosphere.game.state;
|
||||||
|
|
||||||
|
import electrosphere.entity.types.attach.AttachUtils;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.state.MovementTree;
|
import electrosphere.entity.state.MovementTree;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import electrosphere.game.client.player.ClientPlayerData;
|
|||||||
import electrosphere.game.client.terrain.manager.ClientTerrainManager;
|
import electrosphere.game.client.terrain.manager.ClientTerrainManager;
|
||||||
import electrosphere.game.client.world.ClientWorldData;
|
import electrosphere.game.client.world.ClientWorldData;
|
||||||
import electrosphere.game.collision.CommonWorldData;
|
import electrosphere.game.collision.CommonWorldData;
|
||||||
import electrosphere.game.state.AliveManager;
|
import electrosphere.entity.types.life.AliveManager;
|
||||||
import electrosphere.engine.LoadingThread;
|
import electrosphere.engine.LoadingThread;
|
||||||
import electrosphere.game.state.MacroSimulation;
|
import electrosphere.game.state.MacroSimulation;
|
||||||
import electrosphere.game.server.terrain.manager.ServerTerrainManager;
|
import electrosphere.game.server.terrain.manager.ServerTerrainManager;
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import electrosphere.entity.EntityUtils;
|
|||||||
import electrosphere.entity.state.MovementTree;
|
import electrosphere.entity.state.MovementTree;
|
||||||
import electrosphere.entity.types.hitbox.HitboxUtils;
|
import electrosphere.entity.types.hitbox.HitboxUtils;
|
||||||
import electrosphere.entity.types.item.ItemUtils;
|
import electrosphere.entity.types.item.ItemUtils;
|
||||||
import electrosphere.game.state.AttachUtils;
|
import electrosphere.entity.types.attach.AttachUtils;
|
||||||
import electrosphere.engine.LoadingThread;
|
import electrosphere.engine.LoadingThread;
|
||||||
import electrosphere.game.state.MicroSimulation;
|
import electrosphere.game.state.MicroSimulation;
|
||||||
import electrosphere.logger.LoggerInterface;
|
import electrosphere.logger.LoggerInterface;
|
||||||
@ -173,7 +173,7 @@ public class Main {
|
|||||||
//cell tracking values
|
//cell tracking values
|
||||||
Vector3f oldPlayerCharacterPosition = new Vector3f();
|
Vector3f oldPlayerCharacterPosition = new Vector3f();
|
||||||
if(Globals.playerCharacter != null){
|
if(Globals.playerCharacter != null){
|
||||||
oldPlayerCharacterPosition = new Vector3f(EntityUtils.getEntityPosition(Globals.playerCharacter));
|
oldPlayerCharacterPosition = new Vector3f(EntityUtils.getPosition(Globals.playerCharacter));
|
||||||
}
|
}
|
||||||
Vector3f newPlayerCharacterPosition = oldPlayerCharacterPosition;
|
Vector3f newPlayerCharacterPosition = oldPlayerCharacterPosition;
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ public class Main {
|
|||||||
///
|
///
|
||||||
if(Globals.drawCellManager != null){
|
if(Globals.drawCellManager != null){
|
||||||
if(Globals.playerCharacter != null){
|
if(Globals.playerCharacter != null){
|
||||||
newPlayerCharacterPosition = EntityUtils.getEntityPosition(Globals.playerCharacter);
|
newPlayerCharacterPosition = EntityUtils.getPosition(Globals.playerCharacter);
|
||||||
}
|
}
|
||||||
//Cell manager do your things
|
//Cell manager do your things
|
||||||
Globals.drawCellManager.calculateDeltas(oldPlayerCharacterPosition, newPlayerCharacterPosition);
|
Globals.drawCellManager.calculateDeltas(oldPlayerCharacterPosition, newPlayerCharacterPosition);
|
||||||
@ -214,7 +214,7 @@ public class Main {
|
|||||||
updateMouseVariables();
|
updateMouseVariables();
|
||||||
|
|
||||||
if(Globals.playerCharacter != null){
|
if(Globals.playerCharacter != null){
|
||||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera, EntityUtils.getEntityPosition(Globals.playerCharacter));
|
CameraEntityUtils.setCameraCenter(Globals.playerCamera, EntityUtils.getPosition(Globals.playerCharacter));
|
||||||
}
|
}
|
||||||
|
|
||||||
float cam_Player_Orbit_Magnitude = 1f;
|
float cam_Player_Orbit_Magnitude = 1f;
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import electrosphere.entity.Entity;
|
|||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.game.client.world.ClientWorldData;
|
import electrosphere.game.client.world.ClientWorldData;
|
||||||
import electrosphere.game.state.AttachUtils;
|
import electrosphere.entity.types.attach.AttachUtils;
|
||||||
import electrosphere.logger.LoggerInterface;
|
import electrosphere.logger.LoggerInterface;
|
||||||
import electrosphere.main.Globals;
|
import electrosphere.main.Globals;
|
||||||
import electrosphere.main.Main;
|
import electrosphere.main.Main;
|
||||||
@ -53,8 +53,8 @@ public class ClientProtocol {
|
|||||||
case CREATE:
|
case CREATE:
|
||||||
LoggerInterface.loggerNetworking.DEBUG("Spawn ID " + message.getentityID() + " of type " + message.getcreatureType());
|
LoggerInterface.loggerNetworking.DEBUG("Spawn ID " + message.getentityID() + " of type " + message.getcreatureType());
|
||||||
Entity newlySpawnedEntity = EntityUtils.spawnEntityFromEntityMap(message.getcreatureType());;
|
Entity newlySpawnedEntity = EntityUtils.spawnEntityFromEntityMap(message.getcreatureType());;
|
||||||
EntityUtils.getEntityScale(newlySpawnedEntity).set(0.005f);
|
EntityUtils.getScale(newlySpawnedEntity).set(0.005f);
|
||||||
EntityUtils.getEntityPosition(newlySpawnedEntity).set(message.getpositionX(),message.getpositionY(),message.getpositionZ());
|
EntityUtils.getPosition(newlySpawnedEntity).set(message.getpositionX(),message.getpositionY(),message.getpositionZ());
|
||||||
EntityUtils.setEntityID(newlySpawnedEntity, message.getentityID());
|
EntityUtils.setEntityID(newlySpawnedEntity, message.getentityID());
|
||||||
break;
|
break;
|
||||||
case DESTROY:
|
case DESTROY:
|
||||||
@ -65,7 +65,7 @@ public class ClientProtocol {
|
|||||||
Entity target = Globals.entityManager.getEntityFromId(message.getentityID());
|
Entity target = Globals.entityManager.getEntityFromId(message.getentityID());
|
||||||
LoggerInterface.loggerNetworking.DEBUG("ID: " + message.getentityID());
|
LoggerInterface.loggerNetworking.DEBUG("ID: " + message.getentityID());
|
||||||
if(target != null){
|
if(target != null){
|
||||||
EntityUtils.getEntityPosition(target).set(message.getpositionX(),message.getpositionY(),message.getpositionZ());
|
EntityUtils.getPosition(target).set(message.getpositionX(),message.getpositionY(),message.getpositionZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CreatureUtils.attachEntityMessageToMovementTree(Globals.entityManager.getEntityFromId(message.getId()),message);
|
// CreatureUtils.attachEntityMessageToMovementTree(Globals.entityManager.getEntityFromId(message.getId()),message);
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import electrosphere.entity.types.creature.CreatureUtils;
|
|||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
import electrosphere.entity.types.item.ItemUtils;
|
import electrosphere.entity.types.item.ItemUtils;
|
||||||
import electrosphere.game.state.AttachUtils;
|
import electrosphere.entity.types.attach.AttachUtils;
|
||||||
import electrosphere.logger.LoggerInterface;
|
import electrosphere.logger.LoggerInterface;
|
||||||
import electrosphere.main.Globals;
|
import electrosphere.main.Globals;
|
||||||
import electrosphere.main.Main;
|
import electrosphere.main.Main;
|
||||||
@ -95,8 +95,8 @@ public class ServerConnectionHandler implements Runnable {
|
|||||||
//spawn player in world
|
//spawn player in world
|
||||||
Entity newPlayerCharacter = CreatureUtils.spawnBasicCreature(0, 0.001f, 0.05f);
|
Entity newPlayerCharacter = CreatureUtils.spawnBasicCreature(0, 0.001f, 0.05f);
|
||||||
playerCharacterID = newPlayerCharacter.getId();
|
playerCharacterID = newPlayerCharacter.getId();
|
||||||
EntityUtils.getEntityScale(newPlayerCharacter).set(0.005f);
|
EntityUtils.getScale(newPlayerCharacter).set(0.005f);
|
||||||
EntityUtils.getEntityPosition(newPlayerCharacter).set(Globals.spawnPoint.x,0,Globals.spawnPoint.z);
|
EntityUtils.getPosition(newPlayerCharacter).set(Globals.spawnPoint.x,0,Globals.spawnPoint.z);
|
||||||
//spawn player sword
|
//spawn player sword
|
||||||
Entity sword = ItemUtils.spawnBasicItem(2);
|
Entity sword = ItemUtils.spawnBasicItem(2);
|
||||||
AttachUtils.attachEntityToEntityAtBone(newPlayerCharacter, sword, "Bone.020");
|
AttachUtils.attachEntityToEntityAtBone(newPlayerCharacter, sword, "Bone.020");
|
||||||
@ -141,9 +141,9 @@ public class ServerConnectionHandler implements Runnable {
|
|||||||
EntityMessage.constructCreateMessage(
|
EntityMessage.constructCreateMessage(
|
||||||
currentEntity.getId(),
|
currentEntity.getId(),
|
||||||
CreatureUtils.getCreatureType(currentEntity),
|
CreatureUtils.getCreatureType(currentEntity),
|
||||||
EntityUtils.getEntityPosition(currentEntity).x,
|
EntityUtils.getPosition(currentEntity).x,
|
||||||
EntityUtils.getEntityPosition(currentEntity).y,
|
EntityUtils.getPosition(currentEntity).y,
|
||||||
EntityUtils.getEntityPosition(currentEntity).z
|
EntityUtils.getPosition(currentEntity).z
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if(CreatureUtils.isCreature(currentEntity)){
|
if(CreatureUtils.isCreature(currentEntity)){
|
||||||
@ -158,9 +158,9 @@ public class ServerConnectionHandler implements Runnable {
|
|||||||
EntityMessage.constructCreateMessage(
|
EntityMessage.constructCreateMessage(
|
||||||
currentEntity.getId(),
|
currentEntity.getId(),
|
||||||
CreatureUtils.getCreatureType(currentEntity),
|
CreatureUtils.getCreatureType(currentEntity),
|
||||||
EntityUtils.getEntityPosition(currentEntity).x,
|
EntityUtils.getPosition(currentEntity).x,
|
||||||
EntityUtils.getEntityPosition(currentEntity).y,
|
EntityUtils.getPosition(currentEntity).y,
|
||||||
EntityUtils.getEntityPosition(currentEntity).z
|
EntityUtils.getPosition(currentEntity).z
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if(AttachUtils.isAttached(currentEntity)){
|
if(AttachUtils.isAttached(currentEntity)){
|
||||||
|
|||||||
@ -238,16 +238,16 @@ public class RenderingEngine {
|
|||||||
modelTransformMatrix = new Matrix4f();
|
modelTransformMatrix = new Matrix4f();
|
||||||
for(Entity currentEntity : Globals.entityManager.getDrawable()){
|
for(Entity currentEntity : Globals.entityManager.getDrawable()){
|
||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getEntityActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
//increment animations
|
//increment animations
|
||||||
if(currentActor.getCurrentAnimation() != null){
|
if(currentActor.getCurrentAnimation() != null){
|
||||||
currentActor.incrementAnimationTime(deltaTime * 500);
|
currentActor.incrementAnimationTime(deltaTime * 500);
|
||||||
}
|
}
|
||||||
//calculate and apply model transform
|
//calculate and apply model transform
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(new Vector3f(EntityUtils.getEntityPosition(currentEntity)).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera)).sub(new Vector3f(0,1,0)));
|
modelTransformMatrix.translate(new Vector3f(EntityUtils.getPosition(currentEntity)).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera)).sub(new Vector3f(0,1,0)));
|
||||||
modelTransformMatrix.rotate(EntityUtils.getEntityRotation(currentEntity));
|
modelTransformMatrix.rotate(EntityUtils.getRotation(currentEntity));
|
||||||
modelTransformMatrix.scale(EntityUtils.getEntityScale(currentEntity));
|
modelTransformMatrix.scale(EntityUtils.getScale(currentEntity));
|
||||||
currentActor.applyModelMatrix(modelTransformMatrix);
|
currentActor.applyModelMatrix(modelTransformMatrix);
|
||||||
//draw
|
//draw
|
||||||
currentActor.drawForDepthBuffer();
|
currentActor.drawForDepthBuffer();
|
||||||
@ -289,7 +289,7 @@ public class RenderingEngine {
|
|||||||
modelTransformMatrix = new Matrix4f();
|
modelTransformMatrix = new Matrix4f();
|
||||||
for(Entity currentEntity : Globals.entityManager.getDrawable()){
|
for(Entity currentEntity : Globals.entityManager.getDrawable()){
|
||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getEntityActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
//increment animations
|
//increment animations
|
||||||
//this is incremented in the shadow calculations
|
//this is incremented in the shadow calculations
|
||||||
// if(currentActor.getCurrentAnimation() != null){
|
// if(currentActor.getCurrentAnimation() != null){
|
||||||
@ -297,9 +297,9 @@ public class RenderingEngine {
|
|||||||
// }
|
// }
|
||||||
//calculate and apply model transform
|
//calculate and apply model transform
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(new Vector3f(EntityUtils.getEntityPosition(currentEntity)).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera)).sub(new Vector3f(0,1,0)));
|
modelTransformMatrix.translate(new Vector3f(EntityUtils.getPosition(currentEntity)).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera)).sub(new Vector3f(0,1,0)));
|
||||||
modelTransformMatrix.rotate(EntityUtils.getEntityRotation(currentEntity));
|
modelTransformMatrix.rotate(EntityUtils.getRotation(currentEntity));
|
||||||
modelTransformMatrix.scale(EntityUtils.getEntityScale(currentEntity));
|
modelTransformMatrix.scale(EntityUtils.getScale(currentEntity));
|
||||||
currentActor.applyModelMatrix(modelTransformMatrix);
|
currentActor.applyModelMatrix(modelTransformMatrix);
|
||||||
//draw
|
//draw
|
||||||
currentActor.draw();
|
currentActor.draw();
|
||||||
@ -322,7 +322,7 @@ public class RenderingEngine {
|
|||||||
Model hitboxModel;
|
Model hitboxModel;
|
||||||
if(currentHitbox.getData(EntityDataStrings.COLLISION_ENTITY_DATA_TYPE).equals(EntityDataStrings.COLLISION_ENTITY_DATA_TYPE_HURT)){
|
if(currentHitbox.getData(EntityDataStrings.COLLISION_ENTITY_DATA_TYPE).equals(EntityDataStrings.COLLISION_ENTITY_DATA_TYPE_HURT)){
|
||||||
if((hitboxModel = Globals.assetManager.fetchModel("Models/unitsphere.fbx")) != null){
|
if((hitboxModel = Globals.assetManager.fetchModel("Models/unitsphere.fbx")) != null){
|
||||||
Vector3f position = EntityUtils.getEntityPosition(currentHitbox);
|
Vector3f position = EntityUtils.getPosition(currentHitbox);
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(new Vector3f(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera)).sub(new Vector3f(0,1,0)));
|
modelTransformMatrix.translate(new Vector3f(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera)).sub(new Vector3f(0,1,0)));
|
||||||
// modelTransformMatrix.translate(-0.25f, 0.0f, 0.5f); //center sphere
|
// modelTransformMatrix.translate(-0.25f, 0.0f, 0.5f); //center sphere
|
||||||
@ -332,7 +332,7 @@ public class RenderingEngine {
|
|||||||
}
|
}
|
||||||
} else if(currentHitbox.getData(EntityDataStrings.COLLISION_ENTITY_DATA_TYPE).equals(EntityDataStrings.COLLISION_ENTITY_DATA_TYPE_HIT)){
|
} else if(currentHitbox.getData(EntityDataStrings.COLLISION_ENTITY_DATA_TYPE).equals(EntityDataStrings.COLLISION_ENTITY_DATA_TYPE_HIT)){
|
||||||
if((hitboxModel = Globals.assetManager.fetchModel("Models/unitsphere_1.fbx")) != null){
|
if((hitboxModel = Globals.assetManager.fetchModel("Models/unitsphere_1.fbx")) != null){
|
||||||
Vector3f position = EntityUtils.getEntityPosition(currentHitbox);
|
Vector3f position = EntityUtils.getPosition(currentHitbox);
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(new Vector3f(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera)).sub(new Vector3f(0,1,0)));
|
modelTransformMatrix.translate(new Vector3f(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera)).sub(new Vector3f(0,1,0)));
|
||||||
// modelTransformMatrix.translate(-0.25f, 0.0f, 0.5f); //center sphere
|
// modelTransformMatrix.translate(-0.25f, 0.0f, 0.5f); //center sphere
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user