This commit is contained in:
austin 2021-10-24 21:05:13 -04:00
parent 3b31303078
commit 66bec8dead
11 changed files with 106 additions and 10 deletions

View File

@ -5,7 +5,7 @@
"displayWidth" : 1920, "displayWidth" : 1920,
"displayHeight" : 1080, "displayHeight" : 1080,
"graphicsFOV" : 90.0, "graphicsFOV" : 100.0,
"graphicsPerformanceLODChunkRadius" : 3, "graphicsPerformanceLODChunkRadius" : 3,

View File

@ -285,6 +285,65 @@
"onDamageIFrames" : 30 "onDamageIFrames" : 30
}, },
"modelPath" : "Models/unitcube.fbx" "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"
} }

BIN
assets/Models/deer1.fbx Normal file

Binary file not shown.

BIN
assets/Textures/deer1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

View File

@ -107,6 +107,12 @@
"/Textures/falloak1.png", "/Textures/falloak1.png",
"/Textures/falloak1.png" "/Textures/falloak1.png"
] ]
},
"Models/deer1.fbx" : {
"Cube.001" : [
"/Textures/deer1.png",
"/Textures/deer1.png"
]
} }
} }
} }

View File

@ -581,6 +581,14 @@ public class LoadingThread extends Thread {
EntityUtils.getPosition(spark).set(new Vector3f(3,3,3)); EntityUtils.getPosition(spark).set(new Vector3f(3,3,3));
EntityUtils.getScale(spark).mul(1f); 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)); // CollisionObjUtils.positionCharacter(fallOak, new Vector3f(1, 0, 3));
// //
// //

View File

@ -149,14 +149,18 @@ public class MovementTree {
} }
} }
//handle impulses //handle impulses
for(Impulse impulse : collidable.getImpulses()){ if(collidable != null){
// collidable.getImpulses().remove(impulse); for(Impulse impulse : collidable.getImpulses()){
Vector3f impulseForce = new Vector3f(impulse.direction).mul(impulse.force).mul(Main.deltaTime); // collidable.getImpulses().remove(impulse);
// System.out.println("Impulse force: " + impulseForce); Vector3f impulseForce = new Vector3f(impulse.direction).mul(impulse.force).mul(Main.deltaTime);
position.add(impulseForce); // 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 //state machine
switch(state){ switch(state){

View File

@ -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 ) 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.localGetSupportingVertex(new javax.vecmath.Vector3f(1,0,0), aabbMin);
// terrainShape.recalcLocalAabb(); // terrainShape.recalcLocalAabb();
// terrainShape.getLocalAabbMin(aabbMin); // terrainShape.getLocalAabbMin(aabbMin);

View File

@ -207,7 +207,7 @@ public class Globals {
//terrain manager //terrain manager
// public static boolean LOAD_TERRAIN = true; // public static boolean LOAD_TERRAIN = true;
public static ServerTerrainManager serverTerrainManager; 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 //manages all models loaded into memory
public static AssetManager assetManager; public static AssetManager assetManager;
@ -362,6 +362,8 @@ public class Globals {
testingTexture = "Textures/Testing1.png"; testingTexture = "Textures/Testing1.png";
Globals.assetManager.addTexturePathtoQueue(testingTexture); Globals.assetManager.addTexturePathtoQueue(testingTexture);
assetManager.addModelPathToQueue("Models/deer1.fbx");
//as these assets are required for the renderer to work, we go ahead and //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. //load them into memory now. The loading time penalty is worth it I think.
Globals.assetManager.loadAssetsInQueue(); Globals.assetManager.loadAssetsInQueue();

View File

@ -142,7 +142,7 @@ public class ClientProtocol {
Globals.clientTerrainManager.attachWorldMessage(message); Globals.clientTerrainManager.attachWorldMessage(message);
break; break;
case SPAWNPOSITION: case SPAWNPOSITION:
Globals.spawnPoint.set(new Vector3f(message.getrealLocationX(),0,message.getrealLocationY())); Globals.spawnPoint.set(new Vector3f(message.getrealLocationX(),0.25f,message.getrealLocationY()));
break; break;
case CHUNKLOADSTART: case CHUNKLOADSTART:
Globals.clientTerrainManager.attachWorldMessage(message); Globals.clientTerrainManager.attachWorldMessage(message);

View File

@ -390,4 +390,19 @@ public class Model {
} }
return null; 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);
}
}
} }