Tuning gravity more
This commit is contained in:
parent
0d10747f09
commit
bbbeb0f848
@ -94,9 +94,9 @@
|
|||||||
],
|
],
|
||||||
"physicsObject" : {
|
"physicsObject" : {
|
||||||
"type" : "CYLINDER",
|
"type" : "CYLINDER",
|
||||||
"dimension1" : 0.2,
|
"dimension1" : 0.1,
|
||||||
"dimension2" : 0.45,
|
"dimension2" : 0.45,
|
||||||
"dimension3" : 0.2,
|
"dimension3" : 0.1,
|
||||||
"offsetX" : 0,
|
"offsetX" : 0,
|
||||||
"offsetY" : 0.45,
|
"offsetY" : 0.45,
|
||||||
"offsetZ" : 0
|
"offsetZ" : 0
|
||||||
@ -212,11 +212,11 @@
|
|||||||
],
|
],
|
||||||
"physicsObject" : {
|
"physicsObject" : {
|
||||||
"type" : "CYLINDER",
|
"type" : "CYLINDER",
|
||||||
"dimension1" : 0.2,
|
"dimension1" : 0.1,
|
||||||
"dimension2" : 0.2,
|
"dimension2" : 0.1,
|
||||||
"dimension3" : 0.2,
|
"dimension3" : 0.1,
|
||||||
"offsetX" : 0,
|
"offsetX" : 0,
|
||||||
"offsetY" : -0.2,
|
"offsetY" : 0.1,
|
||||||
"offsetZ" : 0
|
"offsetZ" : 0
|
||||||
},
|
},
|
||||||
"attackMoves" : [
|
"attackMoves" : [
|
||||||
|
|||||||
@ -499,15 +499,15 @@ public class LoadingThread extends Thread {
|
|||||||
// EntityUtils.getRotation(building).rotateLocalY((float)(Math.PI));
|
// EntityUtils.getRotation(building).rotateLocalY((float)(Math.PI));
|
||||||
// ActorUtils.applyBlenderTransformer(building);
|
// ActorUtils.applyBlenderTransformer(building);
|
||||||
|
|
||||||
// //spawn evil goblin
|
//spawn evil goblin
|
||||||
// Entity goblin = CreatureUtils.spawnBasicCreature("Goblin");
|
Entity goblin = CreatureUtils.spawnBasicCreature("Goblin");
|
||||||
// CreatureUtils.positionCharacter(goblin, new Vector3f(30, 3, 30));
|
CreatureUtils.positionCharacter(goblin, new Vector3f(30, 0, 30));
|
||||||
// EntityUtils.getScale(goblin).set(0.005f);
|
EntityUtils.getScale(goblin).set(0.005f);
|
||||||
// //give evil goblin sword
|
//give evil goblin sword
|
||||||
// Entity goblinSword = ItemUtils.spawnBasicItem("Katana");
|
Entity goblinSword = ItemUtils.spawnBasicItem("Katana");
|
||||||
// AttachUtils.attachEntityToEntityAtBone(goblin, goblinSword, "Bone.031");
|
AttachUtils.attachEntityToEntityAtBone(goblin, goblinSword, "Bone.031");
|
||||||
// //attach ai to evil goblin
|
//attach ai to evil goblin
|
||||||
// MindlessAttacker.attachToCreature(goblin);
|
MindlessAttacker.attachToCreature(goblin);
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Entity testHomie = CreatureUtils.spawnBasicCreature("Human");
|
// Entity testHomie = CreatureUtils.spawnBasicCreature("Human");
|
||||||
|
|||||||
@ -66,8 +66,8 @@ public class GravityTree {
|
|||||||
state = GravityTreeState.NOT_ACTIVE;
|
state = GravityTreeState.NOT_ACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static final float gravityConstant = 0.3f;
|
static final float gravityConstant = 0.2f;
|
||||||
static final float linearDamping = 0.002f;
|
static final float linearDamping = 0.02f;
|
||||||
|
|
||||||
public void simulate(float deltaTime){
|
public void simulate(float deltaTime){
|
||||||
float velocity = CreatureUtils.getVelocity(parent);
|
float velocity = CreatureUtils.getVelocity(parent);
|
||||||
@ -108,7 +108,7 @@ public class GravityTree {
|
|||||||
if(hadGroundCollision()){
|
if(hadGroundCollision()){
|
||||||
state = GravityTreeState.NOT_ACTIVE;
|
state = GravityTreeState.NOT_ACTIVE;
|
||||||
} else {
|
} else {
|
||||||
float gravityDif = gravityConstant * (float)Math.pow(1.0f - linearDamping,deltaTime);
|
float gravityDif = gravityConstant * (float)Math.pow(1.0f - linearDamping,deltaTime * 2);
|
||||||
Vector3f newGravityPos = new Vector3f(position.x,position.y - gravityDif,position.z);
|
Vector3f newGravityPos = new Vector3f(position.x,position.y - gravityDif,position.z);
|
||||||
float hitFraction = Globals.collisionEngine.sweepTest(body, position, newGravityPos);
|
float hitFraction = Globals.collisionEngine.sweepTest(body, position, newGravityPos);
|
||||||
if(hitFraction >= 0){
|
if(hitFraction >= 0){
|
||||||
|
|||||||
@ -58,7 +58,7 @@ public class CollisionEngine {
|
|||||||
List<CollisionObject> collisionObject = new ArrayList();
|
List<CollisionObject> collisionObject = new ArrayList();
|
||||||
List<Collidable> collidableList = new ArrayList();
|
List<Collidable> collidableList = new ArrayList();
|
||||||
|
|
||||||
static final float linearDamping = 0.2f;
|
static final float linearDamping = 0.02f;
|
||||||
|
|
||||||
public CollisionEngine(){
|
public CollisionEngine(){
|
||||||
broadphase = new DbvtBroadphase();
|
broadphase = new DbvtBroadphase();
|
||||||
@ -95,7 +95,7 @@ public class CollisionEngine {
|
|||||||
if (contactPoint.getDistance() < 0.0f) {
|
if (contactPoint.getDistance() < 0.0f) {
|
||||||
magnitude = contactPoint.getDistance();
|
magnitude = contactPoint.getDistance();
|
||||||
//linear dampen
|
//linear dampen
|
||||||
magnitude = magnitude * (float)Math.pow(1.0f - linearDamping,deltaTime) * deltaTime * 8;
|
magnitude = magnitude * (float)Math.pow(1.0f - linearDamping,deltaTime * 2) * deltaTime * 8;
|
||||||
hit = true;
|
hit = true;
|
||||||
normal = new Vector3f(contactPoint.normalWorldOnB.x,contactPoint.normalWorldOnB.y,contactPoint.normalWorldOnB.z);
|
normal = new Vector3f(contactPoint.normalWorldOnB.x,contactPoint.normalWorldOnB.y,contactPoint.normalWorldOnB.z);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -71,7 +71,7 @@ public class PhysicsUtils {
|
|||||||
for(int y = 0; y < arrayWidth; y++){
|
for(int y = 0; y < arrayWidth; y++){
|
||||||
vertices[vertexInserterPos] = x;
|
vertices[vertexInserterPos] = x;
|
||||||
vertexInserterPos++;
|
vertexInserterPos++;
|
||||||
vertices[vertexInserterPos] = heightfield[x][y] - 0.4f;
|
vertices[vertexInserterPos] = heightfield[x][y];
|
||||||
vertexInserterPos++;
|
vertexInserterPos++;
|
||||||
vertices[vertexInserterPos] = y;
|
vertices[vertexInserterPos] = y;
|
||||||
vertexInserterPos++;
|
vertexInserterPos++;
|
||||||
|
|||||||
@ -94,7 +94,7 @@ public class ServerConnectionHandler implements Runnable {
|
|||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
//spawn player in world
|
//spawn player in world
|
||||||
Entity newPlayerCharacter = CreatureUtils.spawnBasicCreature("Human");
|
Entity newPlayerCharacter = CreatureUtils.spawnBasicCreature("Goblin");
|
||||||
playerCharacterID = newPlayerCharacter.getId();
|
playerCharacterID = newPlayerCharacter.getId();
|
||||||
CreatureUtils.positionCharacter(newPlayerCharacter, new Vector3f(Globals.spawnPoint.x,3,Globals.spawnPoint.z));
|
CreatureUtils.positionCharacter(newPlayerCharacter, new Vector3f(Globals.spawnPoint.x,3,Globals.spawnPoint.z));
|
||||||
//spawn player sword
|
//spawn player sword
|
||||||
|
|||||||
@ -82,7 +82,7 @@ public class RenderingEngine {
|
|||||||
static Framebuffer lightDepthBuffer;
|
static Framebuffer lightDepthBuffer;
|
||||||
|
|
||||||
public static boolean renderHitboxes = false;
|
public static boolean renderHitboxes = false;
|
||||||
public static boolean renderPhysics = false;
|
public static boolean renderPhysics = true;
|
||||||
|
|
||||||
ShaderProgram activeProgram;
|
ShaderProgram activeProgram;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user