aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
diff options
context:
space:
mode:
authorRobert Adams2012-09-18 11:26:19 -0700
committerRobert Adams2012-09-27 22:01:16 -0700
commit91efccabdcb45ed95ae35ab24ed5d3ed5508b463 (patch)
treefb801ca0bd72aae3427a5ca439f807ec3802d7c3 /OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
parentBulletSim: move a bunch of common logic out of BSPrim and BSCharacter (diff)
downloadopensim-SC-91efccabdcb45ed95ae35ab24ed5d3ed5508b463.zip
opensim-SC-91efccabdcb45ed95ae35ab24ed5d3ed5508b463.tar.gz
opensim-SC-91efccabdcb45ed95ae35ab24ed5d3ed5508b463.tar.bz2
opensim-SC-91efccabdcb45ed95ae35ab24ed5d3ed5508b463.tar.xz
BulletSim: Convert BSCharacter to use common BSPhysObject code and variables.
Fix avatar height calculation to properly account for the capsule ends. Rearrange some locking in TerrainManager to eliminate possible race conditions. Move DetailLog() definition into common BSPhysObject class. Some variable renaming to make usage clearer (refactor.rename makes this so easy).
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs28
1 files changed, 17 insertions, 11 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
index 005a758..1e8fe52 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
@@ -77,7 +77,7 @@ public class BSLinkset
77 // A simple linkset of one (no children) 77 // A simple linkset of one (no children)
78 LinksetID = m_nextLinksetID++; 78 LinksetID = m_nextLinksetID++;
79 // We create LOTS of linksets. 79 // We create LOTS of linksets.
80 if (m_nextLinksetID < 0) 80 if (m_nextLinksetID <= 0)
81 m_nextLinksetID = 1; 81 m_nextLinksetID = 1;
82 PhysicsScene = scene; 82 PhysicsScene = scene;
83 LinksetRoot = parent; 83 LinksetRoot = parent;
@@ -157,21 +157,26 @@ public class BSLinkset
157 157
158 private float ComputeLinksetMass() 158 private float ComputeLinksetMass()
159 { 159 {
160 float mass = LinksetRoot.MassRaw; 160 float mass;
161 foreach (BSPhysObject bp in m_children) 161 lock (m_linksetActivityLock)
162 { 162 {
163 mass += bp.MassRaw; 163 mass = LinksetRoot.MassRaw;
164 foreach (BSPhysObject bp in m_children)
165 {
166 mass += bp.MassRaw;
167 }
164 } 168 }
165 return mass; 169 return mass;
166 } 170 }
167 171
168 private OMV.Vector3 ComputeLinksetCenterOfMass() 172 private OMV.Vector3 ComputeLinksetCenterOfMass()
169 { 173 {
170 OMV.Vector3 com = LinksetRoot.Position * LinksetRoot.MassRaw; 174 OMV.Vector3 com;
171 float totalMass = LinksetRoot.MassRaw;
172
173 lock (m_linksetActivityLock) 175 lock (m_linksetActivityLock)
174 { 176 {
177 com = LinksetRoot.Position * LinksetRoot.MassRaw;
178 float totalMass = LinksetRoot.MassRaw;
179
175 foreach (BSPhysObject bp in m_children) 180 foreach (BSPhysObject bp in m_children)
176 { 181 {
177 com += bp.Position * bp.MassRaw; 182 com += bp.Position * bp.MassRaw;
@@ -186,10 +191,11 @@ public class BSLinkset
186 191
187 private OMV.Vector3 ComputeLinksetGeometricCenter() 192 private OMV.Vector3 ComputeLinksetGeometricCenter()
188 { 193 {
189 OMV.Vector3 com = LinksetRoot.Position; 194 OMV.Vector3 com;
190
191 lock (m_linksetActivityLock) 195 lock (m_linksetActivityLock)
192 { 196 {
197 com = LinksetRoot.Position;
198
193 foreach (BSPhysObject bp in m_children) 199 foreach (BSPhysObject bp in m_children)
194 { 200 {
195 com += bp.Position * bp.MassRaw; 201 com += bp.Position * bp.MassRaw;
@@ -208,8 +214,8 @@ public class BSLinkset
208 // Called at taint-time! 214 // Called at taint-time!
209 public bool MakeDynamic(BSPhysObject child) 215 public bool MakeDynamic(BSPhysObject child)
210 { 216 {
211 bool ret = false; 217 // What is done for each object in BSPrim is what we want.
212 return ret; 218 return false;
213 } 219 }
214 220
215 // The object is going static (non-physical). Do any setup necessary 221 // The object is going static (non-physical). Do any setup necessary