adjust physics numbers
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
c706b855cd
commit
4eb4fba8a0
@ -133,8 +133,8 @@
|
|||||||
"movementSystems" : [
|
"movementSystems" : [
|
||||||
{
|
{
|
||||||
"type" : "GROUND",
|
"type" : "GROUND",
|
||||||
"acceleration" : 100.0,
|
"acceleration" : 4000.0,
|
||||||
"maxVelocity" : 50.5,
|
"maxVelocity" : 20.5,
|
||||||
"strafeMultiplier" : 1.0,
|
"strafeMultiplier" : 1.0,
|
||||||
"backpedalMultiplier" : 0.5,
|
"backpedalMultiplier" : 0.5,
|
||||||
"footstepFirstAudioOffset" : 0.2,
|
"footstepFirstAudioOffset" : 0.2,
|
||||||
@ -167,7 +167,7 @@
|
|||||||
{
|
{
|
||||||
"type" : "JUMP",
|
"type" : "JUMP",
|
||||||
"jumpFrames" : 3,
|
"jumpFrames" : 3,
|
||||||
"jumpForce" : 20,
|
"jumpForce" : 1.3,
|
||||||
"animationJump" : {
|
"animationJump" : {
|
||||||
"nameThirdPerson" : "Jump",
|
"nameThirdPerson" : "Jump",
|
||||||
"nameFirstPerson" : "Jump",
|
"nameFirstPerson" : "Jump",
|
||||||
@ -371,6 +371,7 @@
|
|||||||
"dimension1" : 0.2,
|
"dimension1" : 0.2,
|
||||||
"dimension2" : 1.6,
|
"dimension2" : 1.6,
|
||||||
"dimension3" : 0.2,
|
"dimension3" : 0.2,
|
||||||
|
"mass": 0.3,
|
||||||
"rotX": 0,
|
"rotX": 0,
|
||||||
"rotY": 0,
|
"rotY": 0,
|
||||||
"rotZ": 0,
|
"rotZ": 0,
|
||||||
|
|||||||
@ -12,9 +12,9 @@
|
|||||||
],
|
],
|
||||||
"collidable": {
|
"collidable": {
|
||||||
"type" : "CUBE",
|
"type" : "CUBE",
|
||||||
"mass": 1.0,
|
"mass": 0.7,
|
||||||
"rollingFriction": 100.0,
|
"rollingFriction": 1.0,
|
||||||
"linearFriction": 100.0,
|
"linearFriction": 0.001,
|
||||||
"dimension1" : 2.0,
|
"dimension1" : 2.0,
|
||||||
"dimension2" : 2.0,
|
"dimension2" : 2.0,
|
||||||
"dimension3" : 2.0,
|
"dimension3" : 2.0,
|
||||||
|
|||||||
@ -61,7 +61,7 @@ import electrosphere.logger.LoggerInterface;
|
|||||||
public class CollisionEngine {
|
public class CollisionEngine {
|
||||||
|
|
||||||
//gravity constant
|
//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
|
* The damping applied to angular velocity
|
||||||
@ -87,7 +87,16 @@ public class CollisionEngine {
|
|||||||
private static Semaphore spaceLock = new Semaphore(1);
|
private static Semaphore spaceLock = new Semaphore(1);
|
||||||
private DJointGroup contactgroup;
|
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
|
//The list of dbodies ode should be tracking
|
||||||
List<DBody> bodies = new ArrayList<DBody>();
|
List<DBody> bodies = new ArrayList<DBody>();
|
||||||
@ -116,7 +125,7 @@ public class CollisionEngine {
|
|||||||
public CollisionEngine(){
|
public CollisionEngine(){
|
||||||
world = OdeHelper.createWorld();
|
world = OdeHelper.createWorld();
|
||||||
space = OdeHelper.createBHVSpace(Collidable.TYPE_STATIC_BIT);
|
space = OdeHelper.createBHVSpace(Collidable.TYPE_STATIC_BIT);
|
||||||
world.setGravity(0,-0.5,0);
|
world.setGravity(0,-GRAVITY_MAGNITUDE,0);
|
||||||
// world.setAutoDisableFlag(true);
|
// world.setAutoDisableFlag(true);
|
||||||
// world.setContactMaxCorrectingVel(0.1);
|
// world.setContactMaxCorrectingVel(0.1);
|
||||||
// world.setContactSurfaceLayer(0.001);
|
// world.setContactSurfaceLayer(0.001);
|
||||||
|
|||||||
@ -77,7 +77,7 @@ public class SurfaceParams {
|
|||||||
*/
|
*/
|
||||||
public SurfaceParams(){
|
public SurfaceParams(){
|
||||||
mode = OdeConstants.dContactApprox1 & OdeConstants.dContactRolling & OdeConstants.dContactBounce;
|
mode = OdeConstants.dContactApprox1 & OdeConstants.dContactRolling & OdeConstants.dContactBounce;
|
||||||
mu = 0.01;
|
mu = 0.0001;
|
||||||
rho = 10.0;
|
rho = 10.0;
|
||||||
rho2 = 10.0;
|
rho2 = 10.0;
|
||||||
rhoN = 10.0;
|
rhoN = 10.0;
|
||||||
|
|||||||
@ -11,8 +11,6 @@ import electrosphere.entity.Entity;
|
|||||||
import electrosphere.entity.EntityDataStrings;
|
import electrosphere.entity.EntityDataStrings;
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
import electrosphere.entity.btree.BehaviorTree;
|
import electrosphere.entity.btree.BehaviorTree;
|
||||||
import electrosphere.entity.state.gravity.ClientGravityTree;
|
|
||||||
import electrosphere.entity.state.movement.fall.ClientFallTree;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client collidable tree
|
* Client collidable tree
|
||||||
@ -44,31 +42,7 @@ public class ClientCollidableTree implements BehaviorTree {
|
|||||||
public void simulate(float deltaTime){
|
public void simulate(float deltaTime){
|
||||||
Vector3d position = EntityUtils.getPosition(parent);
|
Vector3d position = EntityUtils.getPosition(parent);
|
||||||
Quaterniond rotation = EntityUtils.getRotation(parent);
|
Quaterniond rotation = EntityUtils.getRotation(parent);
|
||||||
Vector3d offsetVector = new Vector3d();
|
|
||||||
Vector3d newPosition = new Vector3d(position);
|
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
|
//bound to world bounds
|
||||||
if(Globals.clientWorldData != null){
|
if(Globals.clientWorldData != null){
|
||||||
if(newPosition.x < Globals.clientWorldData.getWorldBoundMin().x){
|
if(newPosition.x < Globals.clientWorldData.getWorldBoundMin().x){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user