margin of collision improvement

This commit is contained in:
austin 2022-03-30 23:41:03 -04:00
parent 32d8fe21cc
commit 3724f2dcf8
2 changed files with 9 additions and 7 deletions

View File

@ -37,12 +37,12 @@
"idleAnim" : "Sword|Idle",
"collidable": {
"type" : "CUBE",
"dimension1" : 0.1,
"dimension2" : 0.1,
"dimension3" : 0.35,
"offsetX" : 0,
"dimension1" : 0.03,
"dimension2" : 0.03,
"dimension3" : 0.2,
"offsetX" : 0.0,
"offsetY" : 0.05,
"offsetZ" : 0
"offsetZ" : 0.0
},
"iconPath" : "Textures/icons/itemIconWeapon.png"
},

View File

@ -48,6 +48,8 @@ public class PhysicsUtils {
int arrayLength = heightfield.length;
int arrayWidth = heightfield[0].length;
float collisionMargin = 0.08f;
/*
Traditional buffer code not working for some reason
@ -72,7 +74,7 @@ public class PhysicsUtils {
for(int y = 0; y < arrayWidth; y++){
vertices[vertexInserterPos] = x;
vertexInserterPos++;
vertices[vertexInserterPos] = heightfield[x][y];
vertices[vertexInserterPos] = heightfield[x][y] - collisionMargin;
vertexInserterPos++;
vertices[vertexInserterPos] = y;
vertexInserterPos++;
@ -142,7 +144,7 @@ public class PhysicsUtils {
);
//uncomment if we start falling through things again
// terrainShape.setMargin(0.08f);
terrainShape.setMargin(collisionMargin);
// terrainShape.localGetSupportingVertex(new javax.vecmath.Vector3f(1,0,0), aabbMin);
// terrainShape.recalcLocalAabb();