diff --git a/assets/Config/settings.json b/assets/Config/settings.json index 702cac18..e9af34a2 100644 --- a/assets/Config/settings.json +++ b/assets/Config/settings.json @@ -5,7 +5,7 @@ "displayWidth" : 1920, "displayHeight" : 1080, - "graphicsFOV" : 90.0, + "graphicsFOV" : 100.0, "graphicsPerformanceLODChunkRadius" : 3, diff --git a/assets/Data/creatures.json b/assets/Data/creatures.json index 2eae521a..13f461eb 100644 --- a/assets/Data/creatures.json +++ b/assets/Data/creatures.json @@ -285,6 +285,65 @@ "onDamageIFrames" : 30 }, "modelPath" : "Models/unitcube.fbx" + }, + + + + + + + + + + + + + + + { + "name" : "Deer", + "bodyParts" : [ + { + "name" : "Head", + "type" : "Head" + }, + { + "name" : "Torso", + "type" : "Torso" + } + ], + "hitboxes" : [ + { + "type": "hurt", + "bone": "Bone", + "radius": 0.04 + } + ], + "tokens" : [ + "BLENDER_TRANSFORM", + "GRAVITY" + ], + "movementSystems" : [ + { + "type" : "GROUND", + "acceleration" : 0.001, + "maxVelocity" : 0.025 + } + ], + "physicsObject" : { + "type" : "CYLINDER", + "dimension1" : 0.1, + "dimension2" : 0.2, + "dimension3" : 0.1, + "offsetX" : 0, + "offsetY" : 0.2, + "offsetZ" : 0 + }, + "healthSystem" : { + "maxHealth" : 100, + "onDamageIFrames" : 30 + }, + "modelPath" : "Models/deer1.fbx" } diff --git a/assets/Models/deer1.fbx b/assets/Models/deer1.fbx new file mode 100644 index 00000000..7cde68fb Binary files /dev/null and b/assets/Models/deer1.fbx differ diff --git a/assets/Textures/deer1.png b/assets/Textures/deer1.png new file mode 100644 index 00000000..85848e33 Binary files /dev/null and b/assets/Textures/deer1.png differ diff --git a/assets/Textures/default_texture_map.json b/assets/Textures/default_texture_map.json index 8fd62eda..8e0b35f2 100644 --- a/assets/Textures/default_texture_map.json +++ b/assets/Textures/default_texture_map.json @@ -107,6 +107,12 @@ "/Textures/falloak1.png", "/Textures/falloak1.png" ] + }, + "Models/deer1.fbx" : { + "Cube.001" : [ + "/Textures/deer1.png", + "/Textures/deer1.png" + ] } } } \ No newline at end of file diff --git a/src/main/java/electrosphere/engine/LoadingThread.java b/src/main/java/electrosphere/engine/LoadingThread.java index d0452f4d..4606cb8d 100644 --- a/src/main/java/electrosphere/engine/LoadingThread.java +++ b/src/main/java/electrosphere/engine/LoadingThread.java @@ -581,6 +581,14 @@ public class LoadingThread extends Thread { EntityUtils.getPosition(spark).set(new Vector3f(3,3,3)); EntityUtils.getScale(spark).mul(1f); + Entity deer = CreatureUtils.spawnBasicCreature("Deer"); + EntityUtils.getPosition(deer).set(5, 0.25f, 3); + + +// Model deerModel = Globals.assetManager.fetchModel("Models/deer1.fbx"); +// deerModel.describeHighLevel(); + + // CollisionObjUtils.positionCharacter(fallOak, new Vector3f(1, 0, 3)); // // diff --git a/src/main/java/electrosphere/entity/state/movement/MovementTree.java b/src/main/java/electrosphere/entity/state/movement/MovementTree.java index 1e2f4abb..32cd743f 100644 --- a/src/main/java/electrosphere/entity/state/movement/MovementTree.java +++ b/src/main/java/electrosphere/entity/state/movement/MovementTree.java @@ -149,14 +149,18 @@ public class MovementTree { } } //handle impulses - for(Impulse impulse : collidable.getImpulses()){ -// collidable.getImpulses().remove(impulse); - Vector3f impulseForce = new Vector3f(impulse.direction).mul(impulse.force).mul(Main.deltaTime); -// System.out.println("Impulse force: " + impulseForce); - position.add(impulseForce); + if(collidable != null){ + for(Impulse impulse : collidable.getImpulses()){ + // collidable.getImpulses().remove(impulse); + Vector3f impulseForce = new Vector3f(impulse.direction).mul(impulse.force).mul(Main.deltaTime); + // System.out.println("Impulse force: " + impulseForce); + position.add(impulseForce); + } + } + if(body != null){ + bodyTransformMatrix = new javax.vecmath.Matrix4f(PhysicsUtils.jomlToVecmathQuaternionf(rotation),PhysicsUtils.jomlToVecmathVector3f(new Vector3f((float)position.x,(float)position.y,(float)position.z)),1.0f); + body.setWorldTransform(new electrosphere.linearmath.Transform(bodyTransformMatrix)); } - bodyTransformMatrix = new javax.vecmath.Matrix4f(PhysicsUtils.jomlToVecmathQuaternionf(rotation),PhysicsUtils.jomlToVecmathVector3f(new Vector3f((float)position.x,(float)position.y,(float)position.z)),1.0f); - body.setWorldTransform(new electrosphere.linearmath.Transform(bodyTransformMatrix)); //state machine switch(state){ diff --git a/src/main/java/electrosphere/game/collision/PhysicsUtils.java b/src/main/java/electrosphere/game/collision/PhysicsUtils.java index efa9da84..5e0f67f6 100644 --- a/src/main/java/electrosphere/game/collision/PhysicsUtils.java +++ b/src/main/java/electrosphere/game/collision/PhysicsUtils.java @@ -141,6 +141,8 @@ public class PhysicsUtils { true // "useQuantizedAabbCompression" -- apparently means better memory usage ( http://jbullet.advel.cz/javadoc/com/bulletphysics/collision/shapes/BvhTriangleMeshShape.html ) ); + terrainShape.setMargin(0.08f); + // terrainShape.localGetSupportingVertex(new javax.vecmath.Vector3f(1,0,0), aabbMin); // terrainShape.recalcLocalAabb(); // terrainShape.getLocalAabbMin(aabbMin); diff --git a/src/main/java/electrosphere/main/Globals.java b/src/main/java/electrosphere/main/Globals.java index 971127f1..3cb71c33 100644 --- a/src/main/java/electrosphere/main/Globals.java +++ b/src/main/java/electrosphere/main/Globals.java @@ -207,7 +207,7 @@ public class Globals { //terrain manager // public static boolean LOAD_TERRAIN = true; public static ServerTerrainManager serverTerrainManager; - public static Vector3f spawnPoint = new Vector3f(1000,0,1000); + public static Vector3f spawnPoint = new Vector3f(0,0,0); //manages all models loaded into memory public static AssetManager assetManager; @@ -362,6 +362,8 @@ public class Globals { testingTexture = "Textures/Testing1.png"; Globals.assetManager.addTexturePathtoQueue(testingTexture); + assetManager.addModelPathToQueue("Models/deer1.fbx"); + //as these assets are required for the renderer to work, we go ahead and //load them into memory now. The loading time penalty is worth it I think. Globals.assetManager.loadAssetsInQueue(); diff --git a/src/main/java/electrosphere/net/client/ClientProtocol.java b/src/main/java/electrosphere/net/client/ClientProtocol.java index 080caa4c..63c04f18 100644 --- a/src/main/java/electrosphere/net/client/ClientProtocol.java +++ b/src/main/java/electrosphere/net/client/ClientProtocol.java @@ -142,7 +142,7 @@ public class ClientProtocol { Globals.clientTerrainManager.attachWorldMessage(message); break; case SPAWNPOSITION: - Globals.spawnPoint.set(new Vector3f(message.getrealLocationX(),0,message.getrealLocationY())); + Globals.spawnPoint.set(new Vector3f(message.getrealLocationX(),0.25f,message.getrealLocationY())); break; case CHUNKLOADSTART: Globals.clientTerrainManager.attachWorldMessage(message); diff --git a/src/main/java/electrosphere/renderer/Model.java b/src/main/java/electrosphere/renderer/Model.java index 2b80b865..0dea7646 100644 --- a/src/main/java/electrosphere/renderer/Model.java +++ b/src/main/java/electrosphere/renderer/Model.java @@ -390,4 +390,19 @@ public class Model { } return null; } + + public void describeHighLevel(){ + System.out.println("Meshes: "); + for(Mesh mesh : meshes){ + System.out.println(mesh.nodeID); + } + System.out.println("Animations: "); + for(Animation anim : animations){ + System.out.println(anim.name); + } + System.out.println("Bones:"); + for(Bone bone : bones){ + System.out.println(bone.boneID); + } + } }