aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSNPlugin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BSCharacter.cs8
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BSConstraint.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BSConstraint6Dof.cs4
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BSConstraintCollection.cs4
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BSConstraintHinge.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BSDynamics.cs3
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BSLinkset.cs20
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BSLinksetCompound.cs11
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BSLinksetConstraints.cs6
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BSMaterials.cs16
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BSParam.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BSPhysObject.cs3
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BSPrim.cs87
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BSScene.cs11
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BSShapeCollection.cs6
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BSTerrainHeightmap.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BSTerrainManager.cs3
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BulletSimAPI.cs1
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BulletSimData.cs4
19 files changed, 116 insertions, 79 deletions
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSNPlugin/BSCharacter.cs
index 4c4e950..d91c47f 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BSCharacter.cs
@@ -174,7 +174,7 @@ public sealed class BSCharacter : BSPhysObject
174 BulletSimAPI.SetCcdSweptSphereRadius2(PhysBody.ptr, BSParam.CcdSweptSphereRadius); 174 BulletSimAPI.SetCcdSweptSphereRadius2(PhysBody.ptr, BSParam.CcdSweptSphereRadius);
175 } 175 }
176 176
177 UpdatePhysicalMassProperties(RawMass); 177 UpdatePhysicalMassProperties(RawMass, false);
178 178
179 // Make so capsule does not fall over 179 // Make so capsule does not fall over
180 BulletSimAPI.SetAngularFactorV2(PhysBody.ptr, OMV.Vector3.Zero); 180 BulletSimAPI.SetAngularFactorV2(PhysBody.ptr, OMV.Vector3.Zero);
@@ -224,7 +224,7 @@ public sealed class BSCharacter : BSPhysObject
224 if (PhysBody.HasPhysicalBody && PhysShape.HasPhysicalShape) 224 if (PhysBody.HasPhysicalBody && PhysShape.HasPhysicalShape)
225 { 225 {
226 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale); 226 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale);
227 UpdatePhysicalMassProperties(RawMass); 227 UpdatePhysicalMassProperties(RawMass, true);
228 // Make sure this change appears as a property update event 228 // Make sure this change appears as a property update event
229 BulletSimAPI.PushUpdate2(PhysBody.ptr); 229 BulletSimAPI.PushUpdate2(PhysBody.ptr);
230 } 230 }
@@ -260,7 +260,6 @@ public sealed class BSCharacter : BSPhysObject
260 public override void ZeroMotion(bool inTaintTime) 260 public override void ZeroMotion(bool inTaintTime)
261 { 261 {
262 _velocity = OMV.Vector3.Zero; 262 _velocity = OMV.Vector3.Zero;
263 _velocityMotor.Zero();
264 _acceleration = OMV.Vector3.Zero; 263 _acceleration = OMV.Vector3.Zero;
265 _rotationalVelocity = OMV.Vector3.Zero; 264 _rotationalVelocity = OMV.Vector3.Zero;
266 265
@@ -390,7 +389,7 @@ public sealed class BSCharacter : BSPhysObject
390 public override float RawMass { 389 public override float RawMass {
391 get {return _mass; } 390 get {return _mass; }
392 } 391 }
393 public override void UpdatePhysicalMassProperties(float physMass) 392 public override void UpdatePhysicalMassProperties(float physMass, bool inWorld)
394 { 393 {
395 OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass); 394 OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass);
396 BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, localInertia); 395 BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, localInertia);
@@ -787,6 +786,7 @@ public sealed class BSCharacter : BSPhysObject
787 // the motor can be turned off. Set the velocity to zero so the zero motion is sent to the viewer. 786 // the motor can be turned off. Set the velocity to zero so the zero motion is sent to the viewer.
788 if (_velocityMotor.TargetValue.ApproxEquals(OMV.Vector3.Zero, 0.01f) && _velocityMotor.ErrorIsZero) 787 if (_velocityMotor.TargetValue.ApproxEquals(OMV.Vector3.Zero, 0.01f) && _velocityMotor.ErrorIsZero)
789 { 788 {
789 ZeroMotion(true);
790 stepVelocity = OMV.Vector3.Zero; 790 stepVelocity = OMV.Vector3.Zero;
791 _velocityMotor.Enabled = false; 791 _velocityMotor.Enabled = false;
792 DetailLog("{0},BSCharacter.UpdateProperties,taint,disableVelocityMotor,m={1}", LocalID, _velocityMotor); 792 DetailLog("{0},BSCharacter.UpdateProperties,taint,disableVelocityMotor,m={1}", LocalID, _velocityMotor);
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSConstraint.cs b/OpenSim/Region/Physics/BulletSNPlugin/BSConstraint.cs
index 426bdc2..f1bed39 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BSConstraint.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BSConstraint.cs
@@ -36,7 +36,7 @@ public abstract class BSConstraint : IDisposable
36{ 36{
37 private static string LogHeader = "[BULLETSIM CONSTRAINT]"; 37 private static string LogHeader = "[BULLETSIM CONSTRAINT]";
38 38
39 protected BulletSim m_world; 39 protected BulletWorld m_world;
40 protected BulletBody m_body1; 40 protected BulletBody m_body1;
41 protected BulletBody m_body2; 41 protected BulletBody m_body2;
42 protected BulletConstraint m_constraint; 42 protected BulletConstraint m_constraint;
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSConstraint6Dof.cs b/OpenSim/Region/Physics/BulletSNPlugin/BSConstraint6Dof.cs
index 0181d9d..d1e3f55 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BSConstraint6Dof.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BSConstraint6Dof.cs
@@ -39,7 +39,7 @@ public sealed class BSConstraint6Dof : BSConstraint
39 public override ConstraintType Type { get { return ConstraintType.D6_CONSTRAINT_TYPE; } } 39 public override ConstraintType Type { get { return ConstraintType.D6_CONSTRAINT_TYPE; } }
40 40
41 // Create a btGeneric6DofConstraint 41 // Create a btGeneric6DofConstraint
42 public BSConstraint6Dof(BulletSim world, BulletBody obj1, BulletBody obj2, 42 public BSConstraint6Dof(BulletWorld world, BulletBody obj1, BulletBody obj2,
43 Vector3 frame1, Quaternion frame1rot, 43 Vector3 frame1, Quaternion frame1rot,
44 Vector3 frame2, Quaternion frame2rot, 44 Vector3 frame2, Quaternion frame2rot,
45 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) 45 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
@@ -58,7 +58,7 @@ public sealed class BSConstraint6Dof : BSConstraint
58 obj1.ID, obj1.ptr.ToString(), obj2.ID, obj2.ptr.ToString()); 58 obj1.ID, obj1.ptr.ToString(), obj2.ID, obj2.ptr.ToString());
59 } 59 }
60 60
61 public BSConstraint6Dof(BulletSim world, BulletBody obj1, BulletBody obj2, 61 public BSConstraint6Dof(BulletWorld world, BulletBody obj1, BulletBody obj2,
62 Vector3 joinPoint, 62 Vector3 joinPoint,
63 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) 63 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
64 { 64 {
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSConstraintCollection.cs b/OpenSim/Region/Physics/BulletSNPlugin/BSConstraintCollection.cs
index 5c00b1a..87d1e44 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BSConstraintCollection.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BSConstraintCollection.cs
@@ -41,9 +41,9 @@ public sealed class BSConstraintCollection : IDisposable
41 delegate bool ConstraintAction(BSConstraint constrain); 41 delegate bool ConstraintAction(BSConstraint constrain);
42 42
43 private List<BSConstraint> m_constraints; 43 private List<BSConstraint> m_constraints;
44 private BulletSim m_world; 44 private BulletWorld m_world;
45 45
46 public BSConstraintCollection(BulletSim world) 46 public BSConstraintCollection(BulletWorld world)
47 { 47 {
48 m_world = world; 48 m_world = world;
49 m_constraints = new List<BSConstraint>(); 49 m_constraints = new List<BSConstraint>();
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSConstraintHinge.cs b/OpenSim/Region/Physics/BulletSNPlugin/BSConstraintHinge.cs
index 7951f06..fbd1bc0 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BSConstraintHinge.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BSConstraintHinge.cs
@@ -36,7 +36,7 @@ public sealed class BSConstraintHinge : BSConstraint
36{ 36{
37 public override ConstraintType Type { get { return ConstraintType.HINGE_CONSTRAINT_TYPE; } } 37 public override ConstraintType Type { get { return ConstraintType.HINGE_CONSTRAINT_TYPE; } }
38 38
39 public BSConstraintHinge(BulletSim world, BulletBody obj1, BulletBody obj2, 39 public BSConstraintHinge(BulletWorld world, BulletBody obj1, BulletBody obj2,
40 Vector3 pivotInA, Vector3 pivotInB, 40 Vector3 pivotInA, Vector3 pivotInB,
41 Vector3 axisInA, Vector3 axisInB, 41 Vector3 axisInA, Vector3 axisInB,
42 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) 42 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSNPlugin/BSDynamics.cs
index 72afacc..415ad4f 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BSDynamics.cs
@@ -573,6 +573,9 @@ namespace OpenSim.Region.Physics.BulletSNPlugin
573 BulletSimAPI.SetMassProps2(Prim.PhysBody.ptr, m_vehicleMass, localInertia); 573 BulletSimAPI.SetMassProps2(Prim.PhysBody.ptr, m_vehicleMass, localInertia);
574 BulletSimAPI.UpdateInertiaTensor2(Prim.PhysBody.ptr); 574 BulletSimAPI.UpdateInertiaTensor2(Prim.PhysBody.ptr);
575 575
576 Vector3 grav = PhysicsScene.DefaultGravity * (1f - Prim.Buoyancy);
577 BulletSimAPI.SetGravity2(Prim.PhysBody.ptr, grav);
578
576 VDetailLog("{0},BSDynamics.Refresh,mass={1},frict={2},inert={3},aDamp={4}", 579 VDetailLog("{0},BSDynamics.Refresh,mass={1},frict={2},inert={3},aDamp={4}",
577 Prim.LocalID, m_vehicleMass, friction, localInertia, angularDamping); 580 Prim.LocalID, m_vehicleMass, friction, localInertia, angularDamping);
578 } 581 }
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSNPlugin/BSLinkset.cs
index 253128b..845a113 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BSLinkset.cs
@@ -97,14 +97,7 @@ public abstract class BSLinkset
97 } 97 }
98 98
99 // We keep the prim's mass in the linkset structure since it could be dependent on other prims 99 // We keep the prim's mass in the linkset structure since it could be dependent on other prims
100 protected float m_mass; 100 public float LinksetMass { get; protected set; }
101 public float LinksetMass
102 {
103 get
104 {
105 return m_mass;
106 }
107 }
108 101
109 public virtual bool LinksetIsColliding { get { return false; } } 102 public virtual bool LinksetIsColliding { get { return false; } }
110 103
@@ -128,7 +121,7 @@ public abstract class BSLinkset
128 PhysicsScene = scene; 121 PhysicsScene = scene;
129 LinksetRoot = parent; 122 LinksetRoot = parent;
130 m_children = new HashSet<BSPhysObject>(); 123 m_children = new HashSet<BSPhysObject>();
131 m_mass = parent.RawMass; 124 LinksetMass = parent.RawMass;
132 Rebuilding = false; 125 Rebuilding = false;
133 } 126 }
134 127
@@ -143,7 +136,7 @@ public abstract class BSLinkset
143 // Don't add the root to its own linkset 136 // Don't add the root to its own linkset
144 if (!IsRoot(child)) 137 if (!IsRoot(child))
145 AddChildToLinkset(child); 138 AddChildToLinkset(child);
146 m_mass = ComputeLinksetMass(); 139 LinksetMass = ComputeLinksetMass();
147 } 140 }
148 return this; 141 return this;
149 } 142 }
@@ -162,7 +155,7 @@ public abstract class BSLinkset
162 return this; 155 return this;
163 } 156 }
164 RemoveChildFromLinkset(child); 157 RemoveChildFromLinkset(child);
165 m_mass = ComputeLinksetMass(); 158 LinksetMass = ComputeLinksetMass();
166 } 159 }
167 160
168 // The child is down to a linkset of just itself 161 // The child is down to a linkset of just itself
@@ -230,7 +223,10 @@ public abstract class BSLinkset
230 // When physical properties are changed the linkset needs to recalculate 223 // When physical properties are changed the linkset needs to recalculate
231 // its internal properties. 224 // its internal properties.
232 // May be called at runtime or taint-time. 225 // May be called at runtime or taint-time.
233 public abstract void Refresh(BSPhysObject requestor); 226 public virtual void Refresh(BSPhysObject requestor)
227 {
228 LinksetMass = ComputeLinksetMass();
229 }
234 230
235 // Flag denoting the linkset is in the process of being rebuilt. 231 // Flag denoting the linkset is in the process of being rebuilt.
236 // Used to know not the schedule a rebuild in the middle of a rebuild. 232 // Used to know not the schedule a rebuild in the middle of a rebuild.
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSNPlugin/BSLinksetCompound.cs
index 23a0b8b..9a977e6 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BSLinksetCompound.cs
@@ -89,6 +89,8 @@ public sealed class BSLinksetCompound : BSLinkset
89 // its internal properties. 89 // its internal properties.
90 public override void Refresh(BSPhysObject requestor) 90 public override void Refresh(BSPhysObject requestor)
91 { 91 {
92 base.Refresh(requestor);
93
92 // Something changed so do the rebuilding thing 94 // Something changed so do the rebuilding thing
93 // ScheduleRebuild(); 95 // ScheduleRebuild();
94 } 96 }
@@ -96,13 +98,13 @@ public sealed class BSLinksetCompound : BSLinkset
96 // Schedule a refresh to happen after all the other taint processing. 98 // Schedule a refresh to happen after all the other taint processing.
97 private void ScheduleRebuild(BSPhysObject requestor) 99 private void ScheduleRebuild(BSPhysObject requestor)
98 { 100 {
99 DetailLog("{0},BSLinksetCompound.Refresh,schedulingRefresh,rebuilding={1}", 101 DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1}",
100 requestor.LocalID, Rebuilding); 102 requestor.LocalID, Rebuilding);
101 // When rebuilding, it is possible to set properties that would normally require a rebuild. 103 // When rebuilding, it is possible to set properties that would normally require a rebuild.
102 // If already rebuilding, don't request another rebuild. 104 // If already rebuilding, don't request another rebuild.
103 if (!Rebuilding) 105 if (!Rebuilding)
104 { 106 {
105 PhysicsScene.PostTaintObject("BSLinksetCompound.Refresh", LinksetRoot.LocalID, delegate() 107 PhysicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate()
106 { 108 {
107 if (HasAnyChildren) 109 if (HasAnyChildren)
108 RecomputeLinksetCompound(); 110 RecomputeLinksetCompound();
@@ -123,7 +125,6 @@ public sealed class BSLinksetCompound : BSLinkset
123 if (IsRoot(child)) 125 if (IsRoot(child))
124 { 126 {
125 // The root is going dynamic. Make sure mass is properly set. 127 // The root is going dynamic. Make sure mass is properly set.
126 m_mass = ComputeLinksetMass();
127 ScheduleRebuild(LinksetRoot); 128 ScheduleRebuild(LinksetRoot);
128 } 129 }
129 else 130 else
@@ -377,8 +378,8 @@ public sealed class BSLinksetCompound : BSLinkset
377 }); 378 });
378 379
379 // With all of the linkset packed into the root prim, it has the mass of everyone. 380 // With all of the linkset packed into the root prim, it has the mass of everyone.
380 float linksetMass = LinksetMass; 381 LinksetMass = LinksetMass;
381 LinksetRoot.UpdatePhysicalMassProperties(linksetMass); 382 LinksetRoot.UpdatePhysicalMassProperties(LinksetMass, true);
382 } 383 }
383 finally 384 finally
384 { 385 {
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSNPlugin/BSLinksetConstraints.cs
index 5757e64..46ff99f 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BSLinksetConstraints.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BSLinksetConstraints.cs
@@ -46,6 +46,8 @@ public sealed class BSLinksetConstraints : BSLinkset
46 // refresh will happen once after all the other taints are applied. 46 // refresh will happen once after all the other taints are applied.
47 public override void Refresh(BSPhysObject requestor) 47 public override void Refresh(BSPhysObject requestor)
48 { 48 {
49 base.Refresh(requestor);
50
49 // Queue to happen after all the other taint processing 51 // Queue to happen after all the other taint processing
50 PhysicsScene.PostTaintObject("BSLinksetContraints.Refresh", requestor.LocalID, delegate() 52 PhysicsScene.PostTaintObject("BSLinksetContraints.Refresh", requestor.LocalID, delegate()
51 { 53 {
@@ -279,7 +281,7 @@ public sealed class BSLinksetConstraints : BSLinkset
279 private void RecomputeLinksetConstraints() 281 private void RecomputeLinksetConstraints()
280 { 282 {
281 float linksetMass = LinksetMass; 283 float linksetMass = LinksetMass;
282 LinksetRoot.UpdatePhysicalMassProperties(linksetMass); 284 LinksetRoot.UpdatePhysicalMassProperties(linksetMass, true);
283 285
284 // DEBUG: see of inter-linkset collisions are causing problems 286 // DEBUG: see of inter-linkset collisions are causing problems
285 // BulletSimAPI.SetCollisionFilterMask2(LinksetRoot.BSBody.ptr, 287 // BulletSimAPI.SetCollisionFilterMask2(LinksetRoot.BSBody.ptr,
@@ -292,7 +294,7 @@ public sealed class BSLinksetConstraints : BSLinkset
292 // A child in the linkset physically shows the mass of the whole linkset. 294 // A child in the linkset physically shows the mass of the whole linkset.
293 // This allows Bullet to apply enough force on the child to move the whole linkset. 295 // This allows Bullet to apply enough force on the child to move the whole linkset.
294 // (Also do the mass stuff before recomputing the constraint so mass is not zero.) 296 // (Also do the mass stuff before recomputing the constraint so mass is not zero.)
295 child.UpdatePhysicalMassProperties(linksetMass); 297 child.UpdatePhysicalMassProperties(linksetMass, true);
296 298
297 BSConstraint constrain; 299 BSConstraint constrain;
298 if (!PhysicsScene.Constraints.TryGetConstraint(LinksetRoot.PhysBody, child.PhysBody, out constrain)) 300 if (!PhysicsScene.Constraints.TryGetConstraint(LinksetRoot.PhysBody, child.PhysBody, out constrain))
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSMaterials.cs b/OpenSim/Region/Physics/BulletSNPlugin/BSMaterials.cs
index 732191f..d7941b6 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BSMaterials.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BSMaterials.cs
@@ -119,26 +119,26 @@ public static class BSMaterials
119 Attributes[(int)MaterialAttributes.Material.Light] = 119 Attributes[(int)MaterialAttributes.Material.Light] =
120 new MaterialAttributes("light",dDensity, dFriction, dRestitution); 120 new MaterialAttributes("light",dDensity, dFriction, dRestitution);
121 Attributes[(int)MaterialAttributes.Material.Avatar] = 121 Attributes[(int)MaterialAttributes.Material.Avatar] =
122 new MaterialAttributes("avatar",60f, 0.2f, 0f); 122 new MaterialAttributes("avatar",3.5f, 0.2f, 0f);
123 123
124 Attributes[(int)MaterialAttributes.Material.Stone + (int)MaterialAttributes.Material.NumberOfTypes] = 124 Attributes[(int)MaterialAttributes.Material.Stone + (int)MaterialAttributes.Material.NumberOfTypes] =
125 new MaterialAttributes("stonePhysical",dDensity, 0.8f, 0.4f); 125 new MaterialAttributes("stonePhysical",dDensity, 0.8f, 0.4f);
126 Attributes[(int)MaterialAttributes.Material.Metal + (int)MaterialAttributes.Material.NumberOfTypes] = 126 Attributes[(int)MaterialAttributes.Material.Metal + (int)MaterialAttributes.Material.NumberOfTypes] =
127 new MaterialAttributes("metalPhysical",dDensity, 0.8f, 0.4f); 127 new MaterialAttributes("metalPhysical",dDensity, 0.3f, 0.4f);
128 Attributes[(int)MaterialAttributes.Material.Glass + (int)MaterialAttributes.Material.NumberOfTypes] = 128 Attributes[(int)MaterialAttributes.Material.Glass + (int)MaterialAttributes.Material.NumberOfTypes] =
129 new MaterialAttributes("glassPhysical",dDensity, 0.8f, 0.7f); 129 new MaterialAttributes("glassPhysical",dDensity, 0.2f, 0.7f);
130 Attributes[(int)MaterialAttributes.Material.Wood + (int)MaterialAttributes.Material.NumberOfTypes] = 130 Attributes[(int)MaterialAttributes.Material.Wood + (int)MaterialAttributes.Material.NumberOfTypes] =
131 new MaterialAttributes("woodPhysical",dDensity, 0.8f, 0.5f); 131 new MaterialAttributes("woodPhysical",dDensity, 0.6f, 0.5f);
132 Attributes[(int)MaterialAttributes.Material.Flesh + (int)MaterialAttributes.Material.NumberOfTypes] = 132 Attributes[(int)MaterialAttributes.Material.Flesh + (int)MaterialAttributes.Material.NumberOfTypes] =
133 new MaterialAttributes("fleshPhysical",dDensity, 0.8f, 0.3f); 133 new MaterialAttributes("fleshPhysical",dDensity, 0.9f, 0.3f);
134 Attributes[(int)MaterialAttributes.Material.Plastic + (int)MaterialAttributes.Material.NumberOfTypes] = 134 Attributes[(int)MaterialAttributes.Material.Plastic + (int)MaterialAttributes.Material.NumberOfTypes] =
135 new MaterialAttributes("plasticPhysical",dDensity, 0.8f, 0.7f); 135 new MaterialAttributes("plasticPhysical",dDensity, 0.4f, 0.7f);
136 Attributes[(int)MaterialAttributes.Material.Rubber + (int)MaterialAttributes.Material.NumberOfTypes] = 136 Attributes[(int)MaterialAttributes.Material.Rubber + (int)MaterialAttributes.Material.NumberOfTypes] =
137 new MaterialAttributes("rubberPhysical",dDensity, 0.8f, 0.9f); 137 new MaterialAttributes("rubberPhysical",dDensity, 0.9f, 0.9f);
138 Attributes[(int)MaterialAttributes.Material.Light + (int)MaterialAttributes.Material.NumberOfTypes] = 138 Attributes[(int)MaterialAttributes.Material.Light + (int)MaterialAttributes.Material.NumberOfTypes] =
139 new MaterialAttributes("lightPhysical",dDensity, dFriction, dRestitution); 139 new MaterialAttributes("lightPhysical",dDensity, dFriction, dRestitution);
140 Attributes[(int)MaterialAttributes.Material.Avatar + (int)MaterialAttributes.Material.NumberOfTypes] = 140 Attributes[(int)MaterialAttributes.Material.Avatar + (int)MaterialAttributes.Material.NumberOfTypes] =
141 new MaterialAttributes("avatarPhysical",60f, 0.2f, 0f); 141 new MaterialAttributes("avatarPhysical",3.5f, 0.2f, 0f);
142 } 142 }
143 143
144 // Under the [BulletSim] section, one can change the individual material 144 // Under the [BulletSim] section, one can change the individual material
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSNPlugin/BSParam.cs
index 20c0939..5e93a03 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BSParam.cs
@@ -351,7 +351,7 @@ public static class BSParam
351 (s) => { return AvatarStandingFriction; }, 351 (s) => { return AvatarStandingFriction; },
352 (s,p,l,v) => { AvatarStandingFriction = v; } ), 352 (s,p,l,v) => { AvatarStandingFriction = v; } ),
353 new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", 353 new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.",
354 60f, 354 3.5f,
355 (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); }, 355 (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); },
356 (s) => { return AvatarDensity; }, 356 (s) => { return AvatarDensity; },
357 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarDensity=x;}, p, l, v); } ), 357 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarDensity=x;}, p, l, v); } ),
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSNPlugin/BSPhysObject.cs
index 4096ef8..689da7f 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BSPhysObject.cs
@@ -96,7 +96,8 @@ public abstract class BSPhysObject : PhysicsActor
96 // Return the object mass without calculating it or having side effects 96 // Return the object mass without calculating it or having side effects
97 public abstract float RawMass { get; } 97 public abstract float RawMass { get; }
98 // Set the raw mass but also update physical mass properties (inertia, ...) 98 // Set the raw mass but also update physical mass properties (inertia, ...)
99 public abstract void UpdatePhysicalMassProperties(float mass); 99 // 'inWorld' true if the object has already been added to the dynamic world.
100 public abstract void UpdatePhysicalMassProperties(float mass, bool inWorld);
100 101
101 // The last value calculated for the prim's inertia 102 // The last value calculated for the prim's inertia
102 public OMV.Vector3 Inertia { get; set; } 103 public OMV.Vector3 Inertia { get; set; }
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSNPlugin/BSPrim.cs
index a889c24..9c4ba30 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BSPrim.cs
@@ -115,6 +115,8 @@ public sealed class BSPrim : BSPhysObject
115 PhysBody = new BulletBody(LocalID); 115 PhysBody = new BulletBody(LocalID);
116 PhysShape = new BulletShape(); 116 PhysShape = new BulletShape();
117 117
118 Linkset.Refresh(this);
119
118 DetailLog("{0},BSPrim.constructor,call", LocalID); 120 DetailLog("{0},BSPrim.constructor,call", LocalID);
119 // do the actual object creation at taint time 121 // do the actual object creation at taint time
120 PhysicsScene.TaintedObject("BSPrim.create", delegate() 122 PhysicsScene.TaintedObject("BSPrim.create", delegate()
@@ -384,13 +386,13 @@ public sealed class BSPrim : BSPhysObject
384 } 386 }
385 387
386 // Return the effective mass of the object. 388 // Return the effective mass of the object.
387 // If there are multiple items in the linkset, add them together for the root 389 // The definition of this call is to return the mass of the prim.
390 // If the simulator cares about the mass of the linkset, it will sum it itself.
388 public override float Mass 391 public override float Mass
389 { 392 {
390 get 393 get
391 { 394 {
392 return Linkset.LinksetMass; 395 return _mass;
393 // return _mass;
394 } 396 }
395 } 397 }
396 398
@@ -400,22 +402,45 @@ public sealed class BSPrim : BSPhysObject
400 } 402 }
401 // Set the physical mass to the passed mass. 403 // Set the physical mass to the passed mass.
402 // Note that this does not change _mass! 404 // Note that this does not change _mass!
403 public override void UpdatePhysicalMassProperties(float physMass) 405 public override void UpdatePhysicalMassProperties(float physMass, bool inWorld)
404 { 406 {
405 if (IsStatic) 407 if (PhysBody.HasPhysicalBody)
406 { 408 {
407 Inertia = OMV.Vector3.Zero; 409 if (IsStatic)
408 BulletSimAPI.SetMassProps2(PhysBody.ptr, 0f, Inertia); 410 {
409 BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr); 411 Inertia = OMV.Vector3.Zero;
410 } 412 BulletSimAPI.SetMassProps2(PhysBody.ptr, 0f, Inertia);
411 else 413 BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr);
412 { 414 }
413 Inertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass); 415 else
414 BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, Inertia); 416 {
415 BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr); 417 if (inWorld)
416 // center of mass is at the zero of the object 418 {
417 // DEBUG DEBUG BulletSimAPI.SetCenterOfMassByPosRot2(PhysBody.ptr, ForcePosition, ForceOrientation); 419 // Changing interesting properties doesn't change proxy and collision cache
418 DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2}", LocalID, physMass, Inertia); 420 // information. The Bullet solution is to re-add the object to the world
421 // after parameters are changed.
422 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, PhysBody.ptr);
423 }
424
425 Inertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass);
426 BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, Inertia);
427 BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr);
428
429 // center of mass is at the zero of the object
430 // DEBUG DEBUG BulletSimAPI.SetCenterOfMassByPosRot2(PhysBody.ptr, ForcePosition, ForceOrientation);
431 DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2},inWorld={3}", LocalID, physMass, Inertia, inWorld);
432
433 if (inWorld)
434 {
435 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr,_position,_orientation);
436 }
437
438 // Must set gravity after it has been added to the world because, for unknown reasons,
439 // adding the object resets the object's gravity to world gravity
440 OMV.Vector3 grav = PhysicsScene.DefaultGravity * (1f - Buoyancy);
441 BulletSimAPI.SetGravity2(PhysBody.ptr, grav);
442
443 }
419 } 444 }
420 } 445 }
421 446
@@ -714,7 +739,7 @@ public sealed class BSPrim : BSPhysObject
714 Linkset.Refresh(this); 739 Linkset.Refresh(this);
715 740
716 DetailLog("{0},BSPrim.UpdatePhysicalParameters,taintExit,static={1},solid={2},mass={3},collide={4},cf={5:X},body={6},shape={7}", 741 DetailLog("{0},BSPrim.UpdatePhysicalParameters,taintExit,static={1},solid={2},mass={3},collide={4},cf={5:X},body={6},shape={7}",
717 LocalID, IsStatic, IsSolid, _mass, SubscribedEvents(), CurrentCollisionFlags, PhysBody, PhysShape); 742 LocalID, IsStatic, IsSolid, Mass, SubscribedEvents(), CurrentCollisionFlags, PhysBody, PhysShape);
718 } 743 }
719 744
720 // "Making dynamic" means changing to and from static. 745 // "Making dynamic" means changing to and from static.
@@ -737,7 +762,7 @@ public sealed class BSPrim : BSPhysObject
737 BulletSimAPI.SetRestitution2(PhysBody.ptr, matAttrib.restitution); 762 BulletSimAPI.SetRestitution2(PhysBody.ptr, matAttrib.restitution);
738 763
739 // Mass is zero which disables a bunch of physics stuff in Bullet 764 // Mass is zero which disables a bunch of physics stuff in Bullet
740 UpdatePhysicalMassProperties(0f); 765 UpdatePhysicalMassProperties(0f, false);
741 // Set collision detection parameters 766 // Set collision detection parameters
742 if (BSParam.CcdMotionThreshold > 0f) 767 if (BSParam.CcdMotionThreshold > 0f)
743 { 768 {
@@ -777,7 +802,7 @@ public sealed class BSPrim : BSPhysObject
777 // DEBUG DEBUG BulletSimAPI.SetCenterOfMassByPosRot2(Linkset.LinksetRoot.PhysBody.ptr, _position, _orientation); 802 // DEBUG DEBUG BulletSimAPI.SetCenterOfMassByPosRot2(Linkset.LinksetRoot.PhysBody.ptr, _position, _orientation);
778 803
779 // A dynamic object has mass 804 // A dynamic object has mass
780 UpdatePhysicalMassProperties(RawMass); 805 UpdatePhysicalMassProperties(RawMass, false);
781 806
782 // Set collision detection parameters 807 // Set collision detection parameters
783 if (BSParam.CcdMotionThreshold > 0f) 808 if (BSParam.CcdMotionThreshold > 0f)
@@ -950,13 +975,9 @@ public sealed class BSPrim : BSPhysObject
950 set { 975 set {
951 _buoyancy = value; 976 _buoyancy = value;
952 // DetailLog("{0},BSPrim.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy); 977 // DetailLog("{0},BSPrim.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy);
953 // Buoyancy is faked by changing the gravity applied to the object 978 // Force the recalculation of the various inertia,etc variables in the object
954 if (PhysBody.HasPhysicalBody) 979 UpdatePhysicalMassProperties(_mass, true);
955 { 980 ActivateIfPhysical(false);
956 float grav = PhysicsScene.Params.gravity * (1f - _buoyancy);
957 BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav));
958 ActivateIfPhysical(false);
959 }
960 } 981 }
961 } 982 }
962 983
@@ -993,7 +1014,9 @@ public sealed class BSPrim : BSPhysObject
993 public override float APIDDamping { set { return; } } 1014 public override float APIDDamping { set { return; } }
994 1015
995 public override void AddForce(OMV.Vector3 force, bool pushforce) { 1016 public override void AddForce(OMV.Vector3 force, bool pushforce) {
996 AddForce(force, pushforce, false); 1017 // Since this force is being applied in only one step, make this a force per second.
1018 OMV.Vector3 addForce = force / PhysicsScene.LastTimeStep;
1019 AddForce(addForce, pushforce, false);
997 } 1020 }
998 // Applying a force just adds this to the total force on the object. 1021 // Applying a force just adds this to the total force on the object.
999 // This added force will only last the next simulation tick. 1022 // This added force will only last the next simulation tick.
@@ -1001,8 +1024,16 @@ public sealed class BSPrim : BSPhysObject
1001 // for an object, doesn't matter if force is a pushforce or not 1024 // for an object, doesn't matter if force is a pushforce or not
1002 if (force.IsFinite()) 1025 if (force.IsFinite())
1003 { 1026 {
1027 float magnitude = force.Length();
1028 if (magnitude > 20000f)
1029 {
1030 // Force has a limit
1031 force = force / magnitude * 20000f;
1032 }
1033
1004 OMV.Vector3 addForce = force; 1034 OMV.Vector3 addForce = force;
1005 DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce); 1035 DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce);
1036
1006 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate() 1037 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate()
1007 { 1038 {
1008 // Bullet adds this central force to the total force for this tick 1039 // Bullet adds this central force to the total force for this tick
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSNPlugin/BSScene.cs
index 6bcea3f..1a7c34b 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BSScene.cs
@@ -74,7 +74,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
74 74
75 public IMesher mesher; 75 public IMesher mesher;
76 public uint WorldID { get; private set; } 76 public uint WorldID { get; private set; }
77 public BulletSim World { get; private set; } 77 public BulletWorld World { get; private set; }
78 78
79 // All the constraints that have been allocated in this instance. 79 // All the constraints that have been allocated in this instance.
80 public BSConstraintCollection Constraints { get; private set; } 80 public BSConstraintCollection Constraints { get; private set; }
@@ -244,7 +244,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
244 244
245 // m_log.DebugFormat("{0}: Initialize: Calling BulletSimAPI.Initialize.", LogHeader); 245 // m_log.DebugFormat("{0}: Initialize: Calling BulletSimAPI.Initialize.", LogHeader);
246 246
247 World = new BulletSim(0, this, BulletSimAPI.Initialize2(worldExtent, UnmanagedParams, 247 World = new BulletWorld(0, this, BulletSimAPI.Initialize2(worldExtent, UnmanagedParams,
248 m_maxCollisionsPerFrame, ref m_collisionArray, 248 m_maxCollisionsPerFrame, ref m_collisionArray,
249 m_maxUpdatesPerFrame,ref m_updateArray, 249 m_maxUpdatesPerFrame,ref m_updateArray,
250 m_DebugLogCallbackHandle)); 250 m_DebugLogCallbackHandle));
@@ -497,13 +497,16 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
497 497
498 InTaintTime = false; // Only used for debugging so locking is not necessary. 498 InTaintTime = false; // Only used for debugging so locking is not necessary.
499 499
500 // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world.
501 // Only enable this in a limited test world with few objects.
502 // BulletSimAPI.DumpAllInfo2(World.ptr); // DEBUG DEBUG DEBUG
503
500 // step the physical world one interval 504 // step the physical world one interval
501 m_simulationStep++; 505 m_simulationStep++;
502 int numSubSteps = 0; 506 int numSubSteps = 0;
503 507
504 try 508 try
505 { 509 {
506 //if (VehicleLoggingEnabled) DumpVehicles(); // DEBUG
507 if (PhysicsLogging.Enabled) beforeTime = Util.EnvironmentTickCount(); 510 if (PhysicsLogging.Enabled) beforeTime = Util.EnvironmentTickCount();
508 511
509 numSubSteps = BulletSimAPI.PhysicsStep2(World.ptr, timeStep, m_maxSubSteps, m_fixedTimeStep, 512 numSubSteps = BulletSimAPI.PhysicsStep2(World.ptr, timeStep, m_maxSubSteps, m_fixedTimeStep,
@@ -833,7 +836,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
833 { 836 {
834 DetailLog("{0},BSScene.AssertInTaintTime,NOT IN TAINT TIME,Region={1},Where={2}", DetailLogZero, RegionName, whereFrom); 837 DetailLog("{0},BSScene.AssertInTaintTime,NOT IN TAINT TIME,Region={1},Where={2}", DetailLogZero, RegionName, whereFrom);
835 m_log.ErrorFormat("{0} NOT IN TAINT TIME!! Region={1}, Where={2}", LogHeader, RegionName, whereFrom); 838 m_log.ErrorFormat("{0} NOT IN TAINT TIME!! Region={1}, Where={2}", LogHeader, RegionName, whereFrom);
836 Util.PrintCallStack(); // Prints the stack into the DEBUG log file. 839 Util.PrintCallStack(DetailLog);
837 } 840 }
838 return InTaintTime; 841 return InTaintTime;
839 } 842 }
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSNPlugin/BSShapeCollection.cs
index 398ece0..47fb768 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BSShapeCollection.cs
@@ -98,7 +98,7 @@ public sealed class BSShapeCollection : IDisposable
98 // higher level dependencies on the shape or body. Mostly used for LinkSets to 98 // higher level dependencies on the shape or body. Mostly used for LinkSets to
99 // remove the physical constraints before the body is destroyed. 99 // remove the physical constraints before the body is destroyed.
100 // Called at taint-time!! 100 // Called at taint-time!!
101 public bool GetBodyAndShape(bool forceRebuild, BulletSim sim, BSPhysObject prim, 101 public bool GetBodyAndShape(bool forceRebuild, BulletWorld sim, BSPhysObject prim,
102 ShapeDestructionCallback shapeCallback, BodyDestructionCallback bodyCallback) 102 ShapeDestructionCallback shapeCallback, BodyDestructionCallback bodyCallback)
103 { 103 {
104 PhysicsScene.AssertInTaintTime("BSShapeCollection.GetBodyAndShape"); 104 PhysicsScene.AssertInTaintTime("BSShapeCollection.GetBodyAndShape");
@@ -126,7 +126,7 @@ public sealed class BSShapeCollection : IDisposable
126 return ret; 126 return ret;
127 } 127 }
128 128
129 public bool GetBodyAndShape(bool forceRebuild, BulletSim sim, BSPhysObject prim) 129 public bool GetBodyAndShape(bool forceRebuild, BulletWorld sim, BSPhysObject prim)
130 { 130 {
131 return GetBodyAndShape(forceRebuild, sim, prim, null, null); 131 return GetBodyAndShape(forceRebuild, sim, prim, null, null);
132 } 132 }
@@ -918,7 +918,7 @@ public sealed class BSShapeCollection : IDisposable
918 // Updates prim.BSBody with the information about the new body if one is created. 918 // Updates prim.BSBody with the information about the new body if one is created.
919 // Returns 'true' if an object was actually created. 919 // Returns 'true' if an object was actually created.
920 // Called at taint-time. 920 // Called at taint-time.
921 private bool CreateBody(bool forceRebuild, BSPhysObject prim, BulletSim sim, BulletShape shape, 921 private bool CreateBody(bool forceRebuild, BSPhysObject prim, BulletWorld sim, BulletShape shape,
922 BodyDestructionCallback bodyCallback) 922 BodyDestructionCallback bodyCallback)
923 { 923 {
924 bool ret = false; 924 bool ret = false;
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSTerrainHeightmap.cs b/OpenSim/Region/Physics/BulletSNPlugin/BSTerrainHeightmap.cs
index 252953b..ba17059 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BSTerrainHeightmap.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BSTerrainHeightmap.cs
@@ -103,7 +103,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
103 Vector3 centerPos; 103 Vector3 centerPos;
104 centerPos.X = m_mapInfo.minCoords.X + (m_mapInfo.sizeX / 2f); 104 centerPos.X = m_mapInfo.minCoords.X + (m_mapInfo.sizeX / 2f);
105 centerPos.Y = m_mapInfo.minCoords.Y + (m_mapInfo.sizeY / 2f); 105 centerPos.Y = m_mapInfo.minCoords.Y + (m_mapInfo.sizeY / 2f);
106 centerPos.Z = m_mapInfo.minZ + ((m_mapInfo.maxZ - m_mapInfo.minZ) / 2f + 0.5f); 106 centerPos.Z = m_mapInfo.minZ + ((m_mapInfo.maxZ - m_mapInfo.minZ) / 2f - 0.5f);
107 107
108 m_mapInfo.terrainBody = new BulletBody(m_mapInfo.ID, 108 m_mapInfo.terrainBody = new BulletBody(m_mapInfo.ID,
109 BulletSimAPI.CreateBodyWithDefaultMotionState2(m_mapInfo.terrainShape.ptr, 109 BulletSimAPI.CreateBodyWithDefaultMotionState2(m_mapInfo.terrainShape.ptr,
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSNPlugin/BSTerrainManager.cs
index dfad70e..66d62f0 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BSTerrainManager.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BSTerrainManager.cs
@@ -140,7 +140,7 @@ public sealed class BSTerrainManager : IDisposable
140 m_groundPlane = new BulletBody(BSScene.GROUNDPLANE_ID, 140 m_groundPlane = new BulletBody(BSScene.GROUNDPLANE_ID,
141 BulletSimAPI.CreateBodyWithDefaultMotionState2(groundPlaneShape.ptr, BSScene.GROUNDPLANE_ID, 141 BulletSimAPI.CreateBodyWithDefaultMotionState2(groundPlaneShape.ptr, BSScene.GROUNDPLANE_ID,
142 Vector3.Zero, Quaternion.Identity)); 142 Vector3.Zero, Quaternion.Identity));
143 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, m_groundPlane.ptr); 143 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, m_groundPlane.ptr, Vector3.Zero, Quaternion.Identity);
144 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, m_groundPlane.ptr); 144 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, m_groundPlane.ptr);
145 // Ground plane does not move 145 // Ground plane does not move
146 BulletSimAPI.ForceActivationState2(m_groundPlane.ptr, ActivationState.DISABLE_SIMULATION); 146 BulletSimAPI.ForceActivationState2(m_groundPlane.ptr, ActivationState.DISABLE_SIMULATION);
@@ -376,6 +376,7 @@ public sealed class BSTerrainManager : IDisposable
376 DetailLog("{0},BSTerrainManager.GetTerrainHeightAtXYZ,terrainNotFound,pos={1},base={2}", 376 DetailLog("{0},BSTerrainManager.GetTerrainHeightAtXYZ,terrainNotFound,pos={1},base={2}",
377 BSScene.DetailLogZero, pos, terrainBaseXYZ); 377 BSScene.DetailLogZero, pos, terrainBaseXYZ);
378 } 378 }
379
379 lastHeight = ret; 380 lastHeight = ret;
380 return ret; 381 return ret;
381 } 382 }
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSNPlugin/BulletSimAPI.cs
index 6af59d6..93643c9 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BulletSimAPI.cs
@@ -58,7 +58,6 @@ public enum ConstraintType : int
58 MAX_CONSTRAINT_TYPE 58 MAX_CONSTRAINT_TYPE
59} 59}
60 60
61
62// =============================================================================== 61// ===============================================================================
63[StructLayout(LayoutKind.Sequential)] 62[StructLayout(LayoutKind.Sequential)]
64public struct ConvexHull 63public struct ConvexHull
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BulletSimData.cs b/OpenSim/Region/Physics/BulletSNPlugin/BulletSimData.cs
index a1ed8d8..f509dc4 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BulletSimData.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BulletSimData.cs
@@ -35,9 +35,9 @@ namespace OpenSim.Region.Physics.BulletSNPlugin
35// These hold pointers to allocated objects in the unmanaged space. 35// These hold pointers to allocated objects in the unmanaged space.
36 36
37// The physics engine controller class created at initialization 37// The physics engine controller class created at initialization
38public struct BulletSim 38public struct BulletWorld
39{ 39{
40 public BulletSim(uint worldId, BSScene bss, object xx) 40 public BulletWorld(uint worldId, BSScene bss, object xx)
41 { 41 {
42 ptr = xx; 42 ptr = xx;
43 worldID = worldId; 43 worldID = worldId;