BulletSim: Add AvatarRestitution parameter. Centralize computation of buoyancy for flying. Tweek avatar default friction and resititution
parent
6c55fd93a3
commit
cb2727cf6e
|
@ -94,7 +94,7 @@ public class BSCharacter : PhysicsActor
|
|||
_flying = isFlying;
|
||||
_orientation = Quaternion.Identity;
|
||||
_velocity = Vector3.Zero;
|
||||
_buoyancy = isFlying ? 1f : 0f;
|
||||
_buoyancy = ComputeBuoyancyFromFlying(isFlying);
|
||||
_scale = new Vector3(1f, 1f, 1f);
|
||||
_density = _scene.Params.avatarDensity;
|
||||
ComputeAvatarVolumeAndMass(); // set _avatarVolume and _mass based on capsule size, _density and _scale
|
||||
|
@ -110,7 +110,7 @@ public class BSCharacter : PhysicsActor
|
|||
shapeData.Buoyancy = _buoyancy;
|
||||
shapeData.Static = ShapeData.numericFalse;
|
||||
shapeData.Friction = _scene.Params.avatarFriction;
|
||||
shapeData.Restitution = _scene.Params.defaultRestitution;
|
||||
shapeData.Restitution = _scene.Params.avatarRestitution;
|
||||
|
||||
// do actual create at taint time
|
||||
_scene.TaintedObject(delegate()
|
||||
|
@ -261,9 +261,12 @@ public class BSCharacter : PhysicsActor
|
|||
set {
|
||||
_flying = value;
|
||||
// simulate flying by changing the effect of gravity
|
||||
this.Buoyancy(_flying ? 1f : 0f);
|
||||
this.Buoyancy(ComputeBuoyancyFromFlying(_flying));
|
||||
}
|
||||
}
|
||||
private float ComputeBuoyancyFromFlying(bool ifFlying) {
|
||||
return ifFlying ? 1f : 0f;
|
||||
}
|
||||
public override bool
|
||||
SetAlwaysRun {
|
||||
get { return _setAlwaysRun; }
|
||||
|
|
|
@ -235,6 +235,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
|
|||
parms.terrainHitFraction = 0.8f;
|
||||
parms.terrainRestitution = 0f;
|
||||
parms.avatarFriction = 0.5f;
|
||||
parms.avatarRestitution = 0.0f;
|
||||
parms.avatarDensity = 60f;
|
||||
parms.avatarCapsuleRadius = 0.37f;
|
||||
parms.avatarCapsuleHeight = 1.5f; // 2.140599f
|
||||
|
@ -279,7 +280,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
|
|||
parms.terrainHitFraction = pConfig.GetFloat("TerrainHitFraction", parms.terrainHitFraction);
|
||||
parms.terrainRestitution = pConfig.GetFloat("TerrainRestitution", parms.terrainRestitution);
|
||||
parms.avatarFriction = pConfig.GetFloat("AvatarFriction", parms.avatarFriction);
|
||||
parms.avatarRestitution = pConfig.GetFloat("AvatarRestitution", parms.avatarRestitution);
|
||||
parms.avatarDensity = pConfig.GetFloat("AvatarDensity", parms.avatarDensity);
|
||||
parms.avatarRestitution = pConfig.GetFloat("AvatarRestitution", parms.avatarRestitution);
|
||||
parms.avatarCapsuleRadius = pConfig.GetFloat("AvatarCapsuleRadius", parms.avatarCapsuleRadius);
|
||||
parms.avatarCapsuleHeight = pConfig.GetFloat("AvatarCapsuleHeight", parms.avatarCapsuleHeight);
|
||||
}
|
||||
|
|
|
@ -833,7 +833,8 @@
|
|||
TerrainFriction = 0.50
|
||||
TerrainHitFriction = 0.8
|
||||
TerrainRestitution = 0
|
||||
AvatarFriction = 0.5
|
||||
AvatarFriction = 0.2
|
||||
AvatarRestitution = 0.0
|
||||
AvatarDensity = 60.0
|
||||
AvatarCapsuleRadius = 0.37
|
||||
AvatarCapsuleHeight = 1.5
|
||||
|
|
Loading…
Reference in New Issue