adjust physics numbers
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-09-13 18:20:04 -04:00
parent c706b855cd
commit 4eb4fba8a0
5 changed files with 20 additions and 36 deletions

View File

@ -133,8 +133,8 @@
"movementSystems" : [
{
"type" : "GROUND",
"acceleration" : 100.0,
"maxVelocity" : 50.5,
"acceleration" : 4000.0,
"maxVelocity" : 20.5,
"strafeMultiplier" : 1.0,
"backpedalMultiplier" : 0.5,
"footstepFirstAudioOffset" : 0.2,
@ -167,7 +167,7 @@
{
"type" : "JUMP",
"jumpFrames" : 3,
"jumpForce" : 20,
"jumpForce" : 1.3,
"animationJump" : {
"nameThirdPerson" : "Jump",
"nameFirstPerson" : "Jump",
@ -371,6 +371,7 @@
"dimension1" : 0.2,
"dimension2" : 1.6,
"dimension3" : 0.2,
"mass": 0.3,
"rotX": 0,
"rotY": 0,
"rotZ": 0,

View File

@ -12,9 +12,9 @@
],
"collidable": {
"type" : "CUBE",
"mass": 1.0,
"rollingFriction": 100.0,
"linearFriction": 100.0,
"mass": 0.7,
"rollingFriction": 1.0,
"linearFriction": 0.001,
"dimension1" : 2.0,
"dimension2" : 2.0,
"dimension3" : 2.0,

View File

@ -61,7 +61,7 @@ import electrosphere.logger.LoggerInterface;
public class CollisionEngine {
//gravity constant
public static final float GRAVITY_MAGNITUDE = 9.8f * 2;
public static final float GRAVITY_MAGNITUDE = 0.2f;
/**
* The damping applied to angular velocity
@ -87,7 +87,16 @@ public class CollisionEngine {
private static Semaphore spaceLock = new Semaphore(1);
private DJointGroup contactgroup;
private static final int MAX_CONTACTS = 64; // maximum number of contact points per body
// maximum number of contact points per body
/**
* <p> Maximum number of contact points per body </p>
* <p><b> Note: </b></p>
* <p>
* This value must be sufficiently high (I'd recommend 64), in order for large bodies to not sink into other large bodies.
* I used a value of 10 for a long time and found that cubes were sinking into TriMeshes.
* </p>
*/
private static final int MAX_CONTACTS = 64;
//The list of dbodies ode should be tracking
List<DBody> bodies = new ArrayList<DBody>();
@ -116,7 +125,7 @@ public class CollisionEngine {
public CollisionEngine(){
world = OdeHelper.createWorld();
space = OdeHelper.createBHVSpace(Collidable.TYPE_STATIC_BIT);
world.setGravity(0,-0.5,0);
world.setGravity(0,-GRAVITY_MAGNITUDE,0);
// world.setAutoDisableFlag(true);
// world.setContactMaxCorrectingVel(0.1);
// world.setContactSurfaceLayer(0.001);

View File

@ -77,7 +77,7 @@ public class SurfaceParams {
*/
public SurfaceParams(){
mode = OdeConstants.dContactApprox1 & OdeConstants.dContactRolling & OdeConstants.dContactBounce;
mu = 0.01;
mu = 0.0001;
rho = 10.0;
rho2 = 10.0;
rhoN = 10.0;

View File

@ -11,8 +11,6 @@ import electrosphere.entity.Entity;
import electrosphere.entity.EntityDataStrings;
import electrosphere.entity.EntityUtils;
import electrosphere.entity.btree.BehaviorTree;
import electrosphere.entity.state.gravity.ClientGravityTree;
import electrosphere.entity.state.movement.fall.ClientFallTree;
/**
* Client collidable tree
@ -44,31 +42,7 @@ public class ClientCollidableTree implements BehaviorTree {
public void simulate(float deltaTime){
Vector3d position = EntityUtils.getPosition(parent);
Quaterniond rotation = EntityUtils.getRotation(parent);
Vector3d offsetVector = new Vector3d();
Vector3d newPosition = new Vector3d(position);
//have we hit a terrain impulse?
boolean hitTerrain = false;
//handle impulses
for(Impulse impulse : collidable.getImpulses()){
// collidable.getImpulses().remove(impulse);
Vector3d impulseForce = new Vector3d(impulse.getDirection()).mul(impulse.getForce());
if(impulse.type.matches(Collidable.TYPE_TERRAIN)){
hitTerrain = true;
// System.out.println("Impulse force: " + impulseForce);
// System.out.println("Position: " + position);
}
// if(impulse.type.matches(Collidable.TYPE_ITEM)){
// if(ClientGravityTree.getClientGravityTree(parent)!=null){
// ClientGravityTree.getClientGravityTree(parent).start();
// }
// }
// if(impulse.type.matches(Collidable.TYPE_CREATURE)){
// // System.out.println(System.currentTimeMillis() + " creature hit!");
// if(ClientGravityTree.getClientGravityTree(parent)!=null){
// ClientGravityTree.getClientGravityTree(parent).start();
// }
// }
}
//bound to world bounds
if(Globals.clientWorldData != null){
if(newPosition.x < Globals.clientWorldData.getWorldBoundMin().x){