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