aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs')
-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