diff options
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 41 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | 1 |
4 files changed, 47 insertions, 14 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index ee485b4..d4f5c63 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -102,7 +102,9 @@ public class BSCharacter : PhysicsActor | |||
102 | _orientation = Quaternion.Identity; | 102 | _orientation = Quaternion.Identity; |
103 | _velocity = Vector3.Zero; | 103 | _velocity = Vector3.Zero; |
104 | _buoyancy = ComputeBuoyancyFromFlying(isFlying); | 104 | _buoyancy = ComputeBuoyancyFromFlying(isFlying); |
105 | _scale = new Vector3(1f, 1f, 1f); | 105 | // The dimensions of the avatar capsule are kept in the scale. |
106 | // Physics creates a unit capsule which is scaled by the physics engine. | ||
107 | _scale = new Vector3(_scene.Params.avatarCapsuleRadius, _scene.Params.avatarCapsuleRadius, size.Z); | ||
106 | _density = _scene.Params.avatarDensity; | 108 | _density = _scene.Params.avatarDensity; |
107 | ComputeAvatarVolumeAndMass(); // set _avatarVolume and _mass based on capsule size, _density and _scale | 109 | ComputeAvatarVolumeAndMass(); // set _avatarVolume and _mass based on capsule size, _density and _scale |
108 | 110 | ||
@@ -150,9 +152,28 @@ public class BSCharacter : PhysicsActor | |||
150 | public override bool Stopped { | 152 | public override bool Stopped { |
151 | get { return false; } | 153 | get { return false; } |
152 | } | 154 | } |
153 | public override Vector3 Size { | 155 | public override Vector3 Size { |
154 | get { return _size; } | 156 | get |
155 | set { _size = value; | 157 | { |
158 | // Avatar capsule size is kept in the scale parameter. | ||
159 | return new Vector3(_scale.X * 2, _scale.Y * 2, _scale.Z); | ||
160 | } | ||
161 | |||
162 | set { | ||
163 | // When an avatar's size is set, only the height is changed | ||
164 | // and that really only depends on the radius. | ||
165 | _size = value; | ||
166 | _scale.Z = (_size.Z * 1.15f) - (_scale.X + _scale.Y); | ||
167 | |||
168 | // TODO: something has to be done with the avatar's vertical position | ||
169 | |||
170 | ComputeAvatarVolumeAndMass(); | ||
171 | |||
172 | _scene.TaintedObject(delegate() | ||
173 | { | ||
174 | BulletSimAPI.SetObjectScaleMass(_scene.WorldID, LocalID, _scale, _mass, true); | ||
175 | }); | ||
176 | |||
156 | } | 177 | } |
157 | } | 178 | } |
158 | public override PrimitiveBaseShape Shape { | 179 | public override PrimitiveBaseShape Shape { |
@@ -419,9 +440,15 @@ public class BSCharacter : PhysicsActor | |||
419 | { | 440 | { |
420 | _avatarVolume = (float)( | 441 | _avatarVolume = (float)( |
421 | Math.PI | 442 | Math.PI |
422 | * _scene.Params.avatarCapsuleRadius * _scale.X | 443 | * _scale.X |
423 | * _scene.Params.avatarCapsuleRadius * _scale.Y | 444 | * _scale.Y // the area of capsule cylinder |
424 | * _scene.Params.avatarCapsuleHeight * _scale.Z); | 445 | * _scale.Z // times height of capsule cylinder |
446 | + 1.33333333f | ||
447 | * Math.PI | ||
448 | * _scale.X | ||
449 | * Math.Min(_scale.X, _scale.Y) | ||
450 | * _scale.Y // plus the volume of the capsule end caps | ||
451 | ); | ||
425 | _mass = _density * _avatarVolume; | 452 | _mass = _density * _avatarVolume; |
426 | } | 453 | } |
427 | 454 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 8e6685b..11868bc 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -977,8 +977,8 @@ public sealed class BSPrim : PhysicsActor | |||
977 | { | 977 | { |
978 | if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1) | 978 | if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1) |
979 | { | 979 | { |
980 | if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z) | 980 | // if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z) |
981 | { | 981 | // { |
982 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size); | 982 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size); |
983 | if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE)) | 983 | if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE)) |
984 | { | 984 | { |
@@ -989,7 +989,7 @@ public sealed class BSPrim : PhysicsActor | |||
989 | // TODO: do we need to check for and destroy a mesh or hull that might have been left from before? | 989 | // TODO: do we need to check for and destroy a mesh or hull that might have been left from before? |
990 | ret = true; | 990 | ret = true; |
991 | } | 991 | } |
992 | } | 992 | // } |
993 | } | 993 | } |
994 | else | 994 | else |
995 | { | 995 | { |
@@ -1039,7 +1039,7 @@ public sealed class BSPrim : PhysicsActor | |||
1039 | // if this new shape is the same as last time, don't recreate the mesh | 1039 | // if this new shape is the same as last time, don't recreate the mesh |
1040 | if (_meshKey == newMeshKey) return; | 1040 | if (_meshKey == newMeshKey) return; |
1041 | 1041 | ||
1042 | DetailLog("{0},CreateGeomMesh,create,key={1}", LocalID, _meshKey); | 1042 | DetailLog("{0},CreateGeomMesh,create,key={1}", LocalID, newMeshKey); |
1043 | // Since we're recreating new, get rid of any previously generated shape | 1043 | // Since we're recreating new, get rid of any previously generated shape |
1044 | if (_meshKey != 0) | 1044 | if (_meshKey != 0) |
1045 | { | 1045 | { |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 7151908..0e257b6 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -1027,14 +1027,19 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
1027 | (s,p,l,v) => { s.UpdateParameterAvatars(ref s.m_params[0].avatarContactProcessingThreshold, p, l, v); } ), | 1027 | (s,p,l,v) => { s.UpdateParameterAvatars(ref s.m_params[0].avatarContactProcessingThreshold, p, l, v); } ), |
1028 | 1028 | ||
1029 | 1029 | ||
1030 | new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default)", | 1030 | new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", |
1031 | 0f, // zero to disable | 1031 | 0f, // zero to disable |
1032 | (s,cf,p,v) => { s.m_params[0].maxPersistantManifoldPoolSize = cf.GetFloat(p, v); }, | 1032 | (s,cf,p,v) => { s.m_params[0].maxPersistantManifoldPoolSize = cf.GetFloat(p, v); }, |
1033 | (s) => { return s.m_params[0].maxPersistantManifoldPoolSize; }, | 1033 | (s) => { return s.m_params[0].maxPersistantManifoldPoolSize; }, |
1034 | (s,p,l,v) => { s.m_params[0].maxPersistantManifoldPoolSize = v; } ), | 1034 | (s,p,l,v) => { s.m_params[0].maxPersistantManifoldPoolSize = v; } ), |
1035 | new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)", | ||
1036 | 0f, // zero to disable | ||
1037 | (s,cf,p,v) => { s.m_params[0].maxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); }, | ||
1038 | (s) => { return s.m_params[0].maxCollisionAlgorithmPoolSize; }, | ||
1039 | (s,p,l,v) => { s.m_params[0].maxCollisionAlgorithmPoolSize = v; } ), | ||
1035 | new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", | 1040 | new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", |
1036 | ConfigurationParameters.numericTrue, | 1041 | ConfigurationParameters.numericFalse, |
1037 | (s,cf,p,v) => { s.m_params[0].maxPersistantManifoldPoolSize = s.NumericBool(cf.GetBoolean(p, s.BoolNumeric(v))); }, | 1042 | (s,cf,p,v) => { s.m_params[0].shouldDisableContactPoolDynamicAllocation = s.NumericBool(cf.GetBoolean(p, s.BoolNumeric(v))); }, |
1038 | (s) => { return s.m_params[0].shouldDisableContactPoolDynamicAllocation; }, | 1043 | (s) => { return s.m_params[0].shouldDisableContactPoolDynamicAllocation; }, |
1039 | (s,p,l,v) => { s.m_params[0].shouldDisableContactPoolDynamicAllocation = v; } ), | 1044 | (s,p,l,v) => { s.m_params[0].shouldDisableContactPoolDynamicAllocation = v; } ), |
1040 | new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", | 1045 | new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs index 4e05df6..86fc9d2 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | |||
@@ -158,6 +158,7 @@ public struct ConfigurationParameters | |||
158 | public float avatarContactProcessingThreshold; | 158 | public float avatarContactProcessingThreshold; |
159 | 159 | ||
160 | public float maxPersistantManifoldPoolSize; | 160 | public float maxPersistantManifoldPoolSize; |
161 | public float maxCollisionAlgorithmPoolSize; | ||
161 | public float shouldDisableContactPoolDynamicAllocation; | 162 | public float shouldDisableContactPoolDynamicAllocation; |
162 | public float shouldForceUpdateAllAabbs; | 163 | public float shouldForceUpdateAllAabbs; |
163 | public float shouldRandomizeSolverOrder; | 164 | public float shouldRandomizeSolverOrder; |