aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRobert Adams2012-10-17 08:30:10 -0700
committerRobert Adams2012-10-19 10:52:23 -0700
commite87a179c893ef246dae8338e0f56c3fe20458fbc (patch)
tree1699e1fc26a47ba000bbd2392df894dc3247f956
parentBulletSim: remove code in ShapeCollection that hinted at shape sharing. (diff)
downloadopensim-SC-e87a179c893ef246dae8338e0f56c3fe20458fbc.zip
opensim-SC-e87a179c893ef246dae8338e0f56c3fe20458fbc.tar.gz
opensim-SC-e87a179c893ef246dae8338e0f56c3fe20458fbc.tar.bz2
opensim-SC-e87a179c893ef246dae8338e0f56c3fe20458fbc.tar.xz
BulletSim: change nonimal physics frame rate to 55 to give same numbers as ODE.
Change character scaling to represent size of capsule (diameter rather than radius) Modify create capsule call to pass radius and height. Eliminate errors when calculating shape inertia (should have some type checking).
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs46
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs14
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs14
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs26
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs7
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs2
6 files changed, 57 insertions, 52 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 8e1171a..e7bff6e 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -89,13 +89,15 @@ public class BSCharacter : BSPhysObject
89 _appliedVelocity = OMV.Vector3.Zero; 89 _appliedVelocity = OMV.Vector3.Zero;
90 _buoyancy = ComputeBuoyancyFromFlying(isFlying); 90 _buoyancy = ComputeBuoyancyFromFlying(isFlying);
91 _currentFriction = PhysicsScene.Params.avatarStandingFriction; 91 _currentFriction = PhysicsScene.Params.avatarStandingFriction;
92 _avatarDensity = PhysicsScene.Params.avatarDensity;
92 93
93 // The dimensions of the avatar capsule are kept in the scale. 94 // The dimensions of the avatar capsule are kept in the scale.
94 // Physics creates a unit capsule which is scaled by the physics engine. 95 // Physics creates a unit capsule which is scaled by the physics engine.
95 ComputeAvatarScale(_size); 96 ComputeAvatarScale(_size);
96 _avatarDensity = PhysicsScene.Params.avatarDensity;
97 // set _avatarVolume and _mass based on capsule size, _density and Scale 97 // set _avatarVolume and _mass based on capsule size, _density and Scale
98 ComputeAvatarVolumeAndMass(); 98 ComputeAvatarVolumeAndMass();
99 DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5}",
100 LocalID, _size, Scale, _avatarDensity, _avatarVolume, MassRaw);
99 101
100 ShapeData shapeData = new ShapeData(); 102 ShapeData shapeData = new ShapeData();
101 shapeData.ID = LocalID; 103 shapeData.ID = LocalID;
@@ -103,6 +105,7 @@ public class BSCharacter : BSPhysObject
103 shapeData.Position = _position; 105 shapeData.Position = _position;
104 shapeData.Rotation = _orientation; 106 shapeData.Rotation = _orientation;
105 shapeData.Velocity = _velocity; 107 shapeData.Velocity = _velocity;
108 shapeData.Size = Scale;
106 shapeData.Scale = Scale; 109 shapeData.Scale = Scale;
107 shapeData.Mass = _mass; 110 shapeData.Mass = _mass;
108 shapeData.Buoyancy = _buoyancy; 111 shapeData.Buoyancy = _buoyancy;
@@ -114,8 +117,9 @@ public class BSCharacter : BSPhysObject
114 PhysicsScene.TaintedObject("BSCharacter.create", delegate() 117 PhysicsScene.TaintedObject("BSCharacter.create", delegate()
115 { 118 {
116 DetailLog("{0},BSCharacter.create,taint", LocalID); 119 DetailLog("{0},BSCharacter.create,taint", LocalID);
117 PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this, shapeData, null, null, null); 120 // New body and shape into BSBody and BSShape
118 121 PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this, shapeData, null, null, null);
122
119 SetPhysicalProperties(); 123 SetPhysicalProperties();
120 }); 124 });
121 return; 125 return;
@@ -138,7 +142,7 @@ public class BSCharacter : BSPhysObject
138 142
139 ZeroMotion(); 143 ZeroMotion();
140 144
141 OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(BSShape.ptr, MassRaw); 145 OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(BSShape.ptr, MassRaw);
142 BulletSimAPI.SetMassProps2(BSBody.ptr, MassRaw, localInertia); 146 BulletSimAPI.SetMassProps2(BSBody.ptr, MassRaw, localInertia);
143 147
144 ForcePosition = _position; 148 ForcePosition = _position;
@@ -151,13 +155,13 @@ public class BSCharacter : BSPhysObject
151 { 155 {
152 BulletSimAPI.SetCcdMotionThreshold2(BSBody.ptr, PhysicsScene.Params.ccdMotionThreshold); 156 BulletSimAPI.SetCcdMotionThreshold2(BSBody.ptr, PhysicsScene.Params.ccdMotionThreshold);
153 BulletSimAPI.SetCcdSweepSphereRadius2(BSBody.ptr, PhysicsScene.Params.ccdSweptSphereRadius); 157 BulletSimAPI.SetCcdSweepSphereRadius2(BSBody.ptr, PhysicsScene.Params.ccdSweptSphereRadius);
154 } 158 }
155 159
156 BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.CF_CHARACTER_OBJECT); 160 BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.CF_CHARACTER_OBJECT);
157 161
158 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, BSBody.ptr); 162 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, BSBody.ptr);
159 163
160 BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.DISABLE_DEACTIVATION); 164 BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ACTIVE_TAG);
161 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, BSBody.ptr); 165 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, BSBody.ptr);
162 166
163 // Do this after the object has been added to the world 167 // Do this after the object has been added to the world
@@ -176,7 +180,7 @@ public class BSCharacter : BSPhysObject
176 get 180 get
177 { 181 {
178 // Avatar capsule size is kept in the scale parameter. 182 // Avatar capsule size is kept in the scale parameter.
179 return new OMV.Vector3(Scale.X * 2, Scale.Y * 2, Scale.Z); 183 return _size;
180 } 184 }
181 185
182 set { 186 set {
@@ -184,11 +188,13 @@ public class BSCharacter : BSPhysObject
184 _size = value; 188 _size = value;
185 ComputeAvatarScale(_size); 189 ComputeAvatarScale(_size);
186 ComputeAvatarVolumeAndMass(); 190 ComputeAvatarVolumeAndMass();
191 DetailLog("{0},BSCharacter.setSize,call,scale={1},density={2},volume={3},mass={4}",
192 LocalID, Scale, _avatarDensity, _avatarVolume, MassRaw);
187 193
188 PhysicsScene.TaintedObject("BSCharacter.setSize", delegate() 194 PhysicsScene.TaintedObject("BSCharacter.setSize", delegate()
189 { 195 {
190 BulletSimAPI.SetLocalScaling2(BSShape.ptr, Scale); 196 BulletSimAPI.SetLocalScaling2(BSShape.ptr, Scale);
191 OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(BSBody.ptr, MassRaw); 197 OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(BSShape.ptr, MassRaw);
192 BulletSimAPI.SetMassProps2(BSBody.ptr, MassRaw, localInertia); 198 BulletSimAPI.SetMassProps2(BSBody.ptr, MassRaw, localInertia);
193 }); 199 });
194 200
@@ -578,13 +584,13 @@ public class BSCharacter : BSPhysObject
578 private void ComputeAvatarScale(OMV.Vector3 size) 584 private void ComputeAvatarScale(OMV.Vector3 size)
579 { 585 {
580 OMV.Vector3 newScale = OMV.Vector3.Zero; 586 OMV.Vector3 newScale = OMV.Vector3.Zero;
581 newScale.X = PhysicsScene.Params.avatarCapsuleRadius; 587 // Scale wants the diameter so mult radius by two
582 newScale.Y = PhysicsScene.Params.avatarCapsuleRadius; 588 newScale.X = PhysicsScene.Params.avatarCapsuleRadius * 2f;
589 newScale.Y = PhysicsScene.Params.avatarCapsuleRadius * 2f;
583 590
584 // The 1.15 came from ODE but it seems to cause the avatar to float off the ground 591 // From the total height, add the capsule half spheres that are at each end
585 // Scale.Z = (_size.Z * 1.15f) - (Scale.X + Scale.Y); 592 // newScale.Z = (size.Z) - Math.Min(newScale.X, newScale.Y);
586 // From the total height, remove the capsule half spheres that are at each end 593 newScale.Z = (size.Z * 2f);
587 newScale.Z = (size.Z) - (Math.Min(newScale.X, newScale.Y) * 2f);
588 Scale = newScale; 594 Scale = newScale;
589 } 595 }
590 596
@@ -593,14 +599,14 @@ public class BSCharacter : BSPhysObject
593 { 599 {
594 _avatarVolume = (float)( 600 _avatarVolume = (float)(
595 Math.PI 601 Math.PI
596 * Scale.X 602 * (Scale.X / 2f)
597 * Scale.Y // the area of capsule cylinder 603 * (Scale.Y / 2f) // the area of capsule cylinder
598 * Scale.Z // times height of capsule cylinder 604 * Scale.Z // times height of capsule cylinder
599 + 1.33333333f 605 + 1.33333333f
600 * Math.PI 606 * Math.PI
601 * Scale.X 607 * (Scale.X / 2f)
602 * Math.Min(Scale.X, Scale.Y) 608 * (Math.Min(Scale.X, Scale.Y) / 2f)
603 * Scale.Y // plus the volume of the capsule end caps 609 * (Scale.Y / 2f) // plus the volume of the capsule end caps
604 ); 610 );
605 _mass = _avatarDensity * _avatarVolume; 611 _mass = _avatarDensity * _avatarVolume;
606 } 612 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index 34dec26..b8ef338 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -141,18 +141,15 @@ public abstract class BSPhysObject : PhysicsActor
141 // if someone has subscribed for collision events.... 141 // if someone has subscribed for collision events....
142 if (SubscribedEvents()) { 142 if (SubscribedEvents()) {
143 CollisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); 143 CollisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth));
144 // DetailLog("{0},{1}.Collison.AddCollider,call,with={2},point={3},normal={4},depth={5}", 144 DetailLog("{0},{1}.Collison.AddCollider,call,with={2},point={3},normal={4},depth={5}",
145 // LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth); 145 LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth);
146 146
147 ret = true; 147 ret = true;
148 } 148 }
149 return ret; 149 return ret;
150 } 150 }
151 151
152 // Routine to send the collected collisions into the simulator. 152 // Send the collected collisions into the simulator.
153 // Also handles removal of this from the collection of objects with collisions if
154 // there are no collisions from this object. Mechanism is create one last
155 // collision event to make collision_end work.
156 // Called at taint time from within the Step() function thus no locking problems 153 // Called at taint time from within the Step() function thus no locking problems
157 // with CollisionCollection and ObjectsWithNoMoreCollisions. 154 // with CollisionCollection and ObjectsWithNoMoreCollisions.
158 // Return 'true' if there were some actual collisions passed up 155 // Return 'true' if there were some actual collisions passed up
@@ -161,10 +158,9 @@ public abstract class BSPhysObject : PhysicsActor
161 bool ret = true; 158 bool ret = true;
162 159
163 // throttle the collisions to the number of milliseconds specified in the subscription 160 // throttle the collisions to the number of milliseconds specified in the subscription
164 int nowTime = PhysicsScene.SimulationNowTime; 161 if (PhysicsScene.SimulationNowTime >= NextCollisionOkTime)
165 if (nowTime >= NextCollisionOkTime)
166 { 162 {
167 NextCollisionOkTime = nowTime + SubscribedEventsMs; 163 NextCollisionOkTime = PhysicsScene.SimulationNowTime + SubscribedEventsMs;
168 164
169 // We are called if we previously had collisions. If there are no collisions 165 // We are called if we previously had collisions. If there are no collisions
170 // this time, send up one last empty event so OpenSim can sense collision end. 166 // this time, send up one last empty event so OpenSim can sense collision end.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index b9e1908..8013e68 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -48,10 +48,10 @@ public sealed class BSPrim : BSPhysObject
48 48
49 private PrimitiveBaseShape _pbs; 49 private PrimitiveBaseShape _pbs;
50 50
51 // _size is what the user passed. _scale is what we pass to the physics engine with the mesh. 51 // _size is what the user passed. Scale is what we pass to the physics engine with the mesh.
52 // Often _scale is unity because the meshmerizer will apply _size when creating the mesh. 52 // Often Scale is unity because the meshmerizer will apply _size when creating the mesh.
53 private OMV.Vector3 _size; // the multiplier for each mesh dimension as passed by the user 53 private OMV.Vector3 _size; // the multiplier for each mesh dimension as passed by the user
54 private OMV.Vector3 _scale; // the multiplier for each mesh dimension for the mesh as created by the meshmerizer 54 // private OMV.Vector3 _scale; // the multiplier for each mesh dimension for the mesh as created by the meshmerizer
55 55
56 private bool _grabbed; 56 private bool _grabbed;
57 private bool _isSelected; 57 private bool _isSelected;
@@ -98,7 +98,7 @@ public sealed class BSPrim : BSPhysObject
98 _physicsActorType = (int)ActorTypes.Prim; 98 _physicsActorType = (int)ActorTypes.Prim;
99 _position = pos; 99 _position = pos;
100 _size = size; 100 _size = size;
101 _scale = new OMV.Vector3(1f, 1f, 1f); // the scale will be set by CreateGeom depending on object type 101 Scale = new OMV.Vector3(1f, 1f, 1f); // the scale will be set by CreateGeom depending on object type
102 _orientation = rotation; 102 _orientation = rotation;
103 _buoyancy = 1f; 103 _buoyancy = 1f;
104 _velocity = OMV.Vector3.Zero; 104 _velocity = OMV.Vector3.Zero;
@@ -166,7 +166,7 @@ public sealed class BSPrim : BSPhysObject
166 // Since _size changed, the mesh needs to be rebuilt. If rebuilt, all the correct 166 // Since _size changed, the mesh needs to be rebuilt. If rebuilt, all the correct
167 // scale and margins are set. 167 // scale and margins are set.
168 CreateGeomAndObject(true); 168 CreateGeomAndObject(true);
169 // DetailLog("{0},BSPrim.setSize,size={1},scale={2},mass={3},physical={4}", LocalID, _size, _scale, _mass, IsPhysical); 169 // DetailLog("{0},BSPrim.setSize,size={1},scale={2},mass={3},physical={4}", LocalID, _size, Scale, _mass, IsPhysical);
170 }); 170 });
171 } 171 }
172 } 172 }
@@ -1224,7 +1224,8 @@ public sealed class BSPrim : BSPhysObject
1224 shape.Position = _position; 1224 shape.Position = _position;
1225 shape.Rotation = _orientation; 1225 shape.Rotation = _orientation;
1226 shape.Velocity = _velocity; 1226 shape.Velocity = _velocity;
1227 shape.Scale = _scale; 1227 shape.Size = _size;
1228 shape.Scale = Scale;
1228 shape.Mass = _isPhysical ? _mass : 0f; 1229 shape.Mass = _isPhysical ? _mass : 0f;
1229 shape.Buoyancy = _buoyancy; 1230 shape.Buoyancy = _buoyancy;
1230 shape.HullKey = 0; 1231 shape.HullKey = 0;
@@ -1234,7 +1235,6 @@ public sealed class BSPrim : BSPhysObject
1234 shape.Collidable = (!IsPhantom) ? ShapeData.numericTrue : ShapeData.numericFalse; 1235 shape.Collidable = (!IsPhantom) ? ShapeData.numericTrue : ShapeData.numericFalse;
1235 shape.Static = _isPhysical ? ShapeData.numericFalse : ShapeData.numericTrue; 1236 shape.Static = _isPhysical ? ShapeData.numericFalse : ShapeData.numericTrue;
1236 shape.Solid = IsSolid ? ShapeData.numericFalse : ShapeData.numericTrue; 1237 shape.Solid = IsSolid ? ShapeData.numericFalse : ShapeData.numericTrue;
1237 shape.Size = _size;
1238 } 1238 }
1239 // Rebuild the geometry and object. 1239 // Rebuild the geometry and object.
1240 // This is called when the shape changes so we need to recreate the mesh/hull. 1240 // This is called when the shape changes so we need to recreate the mesh/hull.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index c6e8bc4..ab2835c 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -533,7 +533,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
533 } 533 }
534 534
535 // This is a kludge to get avatar movement updates. 535 // This is a kludge to get avatar movement updates.
536 // the simulator expects collisions for avatars even if there are have been no collisions. This updates 536 // The simulator expects collisions for avatars even if there are have been no collisions. This updates
537 // avatar animations and stuff. 537 // avatar animations and stuff.
538 // If you fix avatar animation updates, remove this overhead and let normal collision processing happen. 538 // If you fix avatar animation updates, remove this overhead and let normal collision processing happen.
539 foreach (BSPhysObject bsp in m_avatars) 539 foreach (BSPhysObject bsp in m_avatars)
@@ -577,9 +577,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
577 577
578 // The physics engine returns the number of milliseconds it simulated this call. 578 // The physics engine returns the number of milliseconds it simulated this call.
579 // These are summed and normalized to one second and divided by 1000 to give the reported physics FPS. 579 // These are summed and normalized to one second and divided by 1000 to give the reported physics FPS.
580 // We multiply by 45 to give a recognizable running rate (45 or less). 580 // We multiply by 55 to give a recognizable running rate (55 or less).
581 return numSubSteps * m_fixedTimeStep * 1000 * 45; 581 return numSubSteps * m_fixedTimeStep * 1000 * 55;
582 // return timeStep * 1000 * 45; 582 // return timeStep * 1000 * 55;
583 } 583 }
584 584
585 // Something has collided 585 // Something has collided
@@ -795,7 +795,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
795 795
796 delegate void ParamUser(BSScene scene, IConfig conf, string paramName, float val); 796 delegate void ParamUser(BSScene scene, IConfig conf, string paramName, float val);
797 delegate float ParamGet(BSScene scene); 797 delegate float ParamGet(BSScene scene);
798 delegate void ParamSet(BSScene scene, string paramName, uint localID, float val); 798 delegate void ParamSet(BSScene scene, string paramName, uint localID, float val);
799 delegate void SetOnObject(BSScene scene, BSPhysObject obj, float val); 799 delegate void SetOnObject(BSScene scene, BSPhysObject obj, float val);
800 800
801 private struct ParameterDefn 801 private struct ParameterDefn
@@ -805,7 +805,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
805 public float defaultValue; // default value if not specified anywhere else 805 public float defaultValue; // default value if not specified anywhere else
806 public ParamUser userParam; // get the value from the configuration file 806 public ParamUser userParam; // get the value from the configuration file
807 public ParamGet getter; // return the current value stored for this parameter 807 public ParamGet getter; // return the current value stored for this parameter
808 public ParamSet setter; // set the current value for this parameter 808 public ParamSet setter; // set the current value for this parameter
809 public SetOnObject onObject; // set the value on an object in the physical domain 809 public SetOnObject onObject; // set the value on an object in the physical domain
810 public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s) 810 public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s)
811 { 811 {
@@ -814,7 +814,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
814 defaultValue = v; 814 defaultValue = v;
815 userParam = u; 815 userParam = u;
816 getter = g; 816 getter = g;
817 setter = s; 817 setter = s;
818 onObject = null; 818 onObject = null;
819 } 819 }
820 public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s, SetOnObject o) 820 public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s, SetOnObject o)
@@ -824,7 +824,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
824 defaultValue = v; 824 defaultValue = v;
825 userParam = u; 825 userParam = u;
826 getter = g; 826 getter = g;
827 setter = s; 827 setter = s;
828 onObject = o; 828 onObject = o;
829 } 829 }
830 } 830 }
@@ -1266,13 +1266,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters
1266 objectIDs.Add(TERRAIN_ID); 1266 objectIDs.Add(TERRAIN_ID);
1267 TaintedUpdateParameter(parm, objectIDs, val); 1267 TaintedUpdateParameter(parm, objectIDs, val);
1268 break; 1268 break;
1269 case PhysParameterEntry.APPLY_TO_ALL: 1269 case PhysParameterEntry.APPLY_TO_ALL:
1270 defaultLoc = val; // setting ALL also sets the default value 1270 defaultLoc = val; // setting ALL also sets the default value
1271 lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys); 1271 lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys);
1272 TaintedUpdateParameter(parm, objectIDs, val); 1272 TaintedUpdateParameter(parm, objectIDs, val);
1273 break; 1273 break;
1274 default: 1274 default:
1275 // setting only one localID 1275 // setting only one localID
1276 objectIDs.Add(localID); 1276 objectIDs.Add(localID);
1277 TaintedUpdateParameter(parm, objectIDs, val); 1277 TaintedUpdateParameter(parm, objectIDs, val);
1278 break; 1278 break;
@@ -1282,8 +1282,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters
1282 // schedule the actual updating of the paramter to when the phys engine is not busy 1282 // schedule the actual updating of the paramter to when the phys engine is not busy
1283 protected void TaintedUpdateParameter(string parm, List<uint> lIDs, float val) 1283 protected void TaintedUpdateParameter(string parm, List<uint> lIDs, float val)
1284 { 1284 {
1285 float xval = val; 1285 float xval = val;
1286 List<uint> xlIDs = lIDs; 1286 List<uint> xlIDs = lIDs;
1287 string xparm = parm; 1287 string xparm = parm;
1288 TaintedObject("BSScene.UpdateParameterSet", delegate() { 1288 TaintedObject("BSScene.UpdateParameterSet", delegate() {
1289 ParameterDefn thisParam; 1289 ParameterDefn thisParam;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index bbfdac6..3d15eaa 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -417,7 +417,10 @@ public class BSShapeCollection : IDisposable
417 417
418 if (shapeType == ShapeData.PhysicsShapeType.SHAPE_AVATAR) 418 if (shapeType == ShapeData.PhysicsShapeType.SHAPE_AVATAR)
419 { 419 {
420 newShape = new BulletShape(BulletSimAPI.BuildCapsuleShape2(PhysicsScene.World.ptr, shapeData), shapeType); 420 // The radius is scaled by 1/2 because we scale by the diameter.
421 newShape = new BulletShape(
422 BulletSimAPI.BuildCapsuleShape2(PhysicsScene.World.ptr, 0.5f, 1.0f, shapeData.Scale),
423 shapeType);
421 newShape.shapeKey = (System.UInt64)shapeKey; 424 newShape.shapeKey = (System.UInt64)shapeKey;
422 newShape.isNativeShape = true; 425 newShape.isNativeShape = true;
423 } 426 }
@@ -428,7 +431,7 @@ public class BSShapeCollection : IDisposable
428 newShape.isNativeShape = true; 431 newShape.isNativeShape = true;
429 } 432 }
430 433
431 // Don't need to do a 'ReferenceShape()' here because native shapes are not tracked. 434 // Don't need to do a 'ReferenceShape()' here because native shapes are not shared.
432 // DetailLog("{0},BSShapeCollection.AddNativeShapeToPrim,create,newshape={1}", shapeData.ID, newShape); 435 // DetailLog("{0},BSShapeCollection.AddNativeShapeToPrim,create,newshape={1}", shapeData.ID, newShape);
433 436
434 prim.BSShape = newShape; 437 prim.BSShape = newShape;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index 30754a7..24d8db6 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -608,7 +608,7 @@ public static extern IntPtr BuildNativeShape2(IntPtr world, ShapeData shapeData)
608public static extern bool IsNativeShape2(IntPtr shape); 608public static extern bool IsNativeShape2(IntPtr shape);
609 609
610[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 610[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
611public static extern IntPtr BuildCapsuleShape2(IntPtr world, ShapeData shapeData); 611public static extern IntPtr BuildCapsuleShape2(IntPtr world, float radius, float height, Vector3 scale);
612 612
613[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 613[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
614public static extern IntPtr CreateCompoundShape2(IntPtr sim); 614public static extern IntPtr CreateCompoundShape2(IntPtr sim);