Merge branch 'master' into careminster
commit
6ed3761147
|
@ -102,7 +102,9 @@ public class BSCharacter : PhysicsActor
|
||||||
_orientation = Quaternion.Identity;
|
_orientation = Quaternion.Identity;
|
||||||
_velocity = Vector3.Zero;
|
_velocity = Vector3.Zero;
|
||||||
_buoyancy = ComputeBuoyancyFromFlying(isFlying);
|
_buoyancy = ComputeBuoyancyFromFlying(isFlying);
|
||||||
_scale = new Vector3(1f, 1f, 1f);
|
// The dimensions of the avatar capsule are kept in the scale.
|
||||||
|
// Physics creates a unit capsule which is scaled by the physics engine.
|
||||||
|
_scale = new Vector3(_scene.Params.avatarCapsuleRadius, _scene.Params.avatarCapsuleRadius, size.Z);
|
||||||
_density = _scene.Params.avatarDensity;
|
_density = _scene.Params.avatarDensity;
|
||||||
ComputeAvatarVolumeAndMass(); // set _avatarVolume and _mass based on capsule size, _density and _scale
|
ComputeAvatarVolumeAndMass(); // set _avatarVolume and _mass based on capsule size, _density and _scale
|
||||||
|
|
||||||
|
@ -151,8 +153,27 @@ public class BSCharacter : PhysicsActor
|
||||||
get { return false; }
|
get { return false; }
|
||||||
}
|
}
|
||||||
public override Vector3 Size {
|
public override Vector3 Size {
|
||||||
get { return _size; }
|
get
|
||||||
set { _size = value;
|
{
|
||||||
|
// Avatar capsule size is kept in the scale parameter.
|
||||||
|
return new Vector3(_scale.X * 2, _scale.Y * 2, _scale.Z);
|
||||||
|
}
|
||||||
|
|
||||||
|
set {
|
||||||
|
// When an avatar's size is set, only the height is changed
|
||||||
|
// and that really only depends on the radius.
|
||||||
|
_size = value;
|
||||||
|
_scale.Z = (_size.Z * 1.15f) - (_scale.X + _scale.Y);
|
||||||
|
|
||||||
|
// TODO: something has to be done with the avatar's vertical position
|
||||||
|
|
||||||
|
ComputeAvatarVolumeAndMass();
|
||||||
|
|
||||||
|
_scene.TaintedObject(delegate()
|
||||||
|
{
|
||||||
|
BulletSimAPI.SetObjectScaleMass(_scene.WorldID, LocalID, _scale, _mass, true);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public override PrimitiveBaseShape Shape {
|
public override PrimitiveBaseShape Shape {
|
||||||
|
@ -419,9 +440,15 @@ public class BSCharacter : PhysicsActor
|
||||||
{
|
{
|
||||||
_avatarVolume = (float)(
|
_avatarVolume = (float)(
|
||||||
Math.PI
|
Math.PI
|
||||||
* _scene.Params.avatarCapsuleRadius * _scale.X
|
* _scale.X
|
||||||
* _scene.Params.avatarCapsuleRadius * _scale.Y
|
* _scale.Y // the area of capsule cylinder
|
||||||
* _scene.Params.avatarCapsuleHeight * _scale.Z);
|
* _scale.Z // times height of capsule cylinder
|
||||||
|
+ 1.33333333f
|
||||||
|
* Math.PI
|
||||||
|
* _scale.X
|
||||||
|
* Math.Min(_scale.X, _scale.Y)
|
||||||
|
* _scale.Y // plus the volume of the capsule end caps
|
||||||
|
);
|
||||||
_mass = _density * _avatarVolume;
|
_mass = _density * _avatarVolume;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -977,8 +977,8 @@ public sealed class BSPrim : PhysicsActor
|
||||||
{
|
{
|
||||||
if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1)
|
if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1)
|
||||||
{
|
{
|
||||||
if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z)
|
// if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z)
|
||||||
{
|
// {
|
||||||
// m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size);
|
// m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size);
|
||||||
if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE))
|
if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE))
|
||||||
{
|
{
|
||||||
|
@ -989,7 +989,7 @@ public sealed class BSPrim : PhysicsActor
|
||||||
// TODO: do we need to check for and destroy a mesh or hull that might have been left from before?
|
// TODO: do we need to check for and destroy a mesh or hull that might have been left from before?
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1039,7 +1039,7 @@ public sealed class BSPrim : PhysicsActor
|
||||||
// if this new shape is the same as last time, don't recreate the mesh
|
// if this new shape is the same as last time, don't recreate the mesh
|
||||||
if (_meshKey == newMeshKey) return;
|
if (_meshKey == newMeshKey) return;
|
||||||
|
|
||||||
DetailLog("{0},CreateGeomMesh,create,key={1}", LocalID, _meshKey);
|
DetailLog("{0},CreateGeomMesh,create,key={1}", LocalID, newMeshKey);
|
||||||
// Since we're recreating new, get rid of any previously generated shape
|
// Since we're recreating new, get rid of any previously generated shape
|
||||||
if (_meshKey != 0)
|
if (_meshKey != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1027,14 +1027,19 @@ public class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
(s,p,l,v) => { s.UpdateParameterAvatars(ref s.m_params[0].avatarContactProcessingThreshold, p, l, v); } ),
|
(s,p,l,v) => { s.UpdateParameterAvatars(ref s.m_params[0].avatarContactProcessingThreshold, p, l, v); } ),
|
||||||
|
|
||||||
|
|
||||||
new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default)",
|
new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)",
|
||||||
0f, // zero to disable
|
0f, // zero to disable
|
||||||
(s,cf,p,v) => { s.m_params[0].maxPersistantManifoldPoolSize = cf.GetFloat(p, v); },
|
(s,cf,p,v) => { s.m_params[0].maxPersistantManifoldPoolSize = cf.GetFloat(p, v); },
|
||||||
(s) => { return s.m_params[0].maxPersistantManifoldPoolSize; },
|
(s) => { return s.m_params[0].maxPersistantManifoldPoolSize; },
|
||||||
(s,p,l,v) => { s.m_params[0].maxPersistantManifoldPoolSize = v; } ),
|
(s,p,l,v) => { s.m_params[0].maxPersistantManifoldPoolSize = v; } ),
|
||||||
|
new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)",
|
||||||
|
0f, // zero to disable
|
||||||
|
(s,cf,p,v) => { s.m_params[0].maxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); },
|
||||||
|
(s) => { return s.m_params[0].maxCollisionAlgorithmPoolSize; },
|
||||||
|
(s,p,l,v) => { s.m_params[0].maxCollisionAlgorithmPoolSize = v; } ),
|
||||||
new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count",
|
new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count",
|
||||||
ConfigurationParameters.numericTrue,
|
ConfigurationParameters.numericFalse,
|
||||||
(s,cf,p,v) => { s.m_params[0].maxPersistantManifoldPoolSize = s.NumericBool(cf.GetBoolean(p, s.BoolNumeric(v))); },
|
(s,cf,p,v) => { s.m_params[0].shouldDisableContactPoolDynamicAllocation = s.NumericBool(cf.GetBoolean(p, s.BoolNumeric(v))); },
|
||||||
(s) => { return s.m_params[0].shouldDisableContactPoolDynamicAllocation; },
|
(s) => { return s.m_params[0].shouldDisableContactPoolDynamicAllocation; },
|
||||||
(s,p,l,v) => { s.m_params[0].shouldDisableContactPoolDynamicAllocation = v; } ),
|
(s,p,l,v) => { s.m_params[0].shouldDisableContactPoolDynamicAllocation = v; } ),
|
||||||
new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step",
|
new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step",
|
||||||
|
|
|
@ -158,6 +158,7 @@ public struct ConfigurationParameters
|
||||||
public float avatarContactProcessingThreshold;
|
public float avatarContactProcessingThreshold;
|
||||||
|
|
||||||
public float maxPersistantManifoldPoolSize;
|
public float maxPersistantManifoldPoolSize;
|
||||||
|
public float maxCollisionAlgorithmPoolSize;
|
||||||
public float shouldDisableContactPoolDynamicAllocation;
|
public float shouldDisableContactPoolDynamicAllocation;
|
||||||
public float shouldForceUpdateAllAabbs;
|
public float shouldForceUpdateAllAabbs;
|
||||||
public float shouldRandomizeSolverOrder;
|
public float shouldRandomizeSolverOrder;
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue