aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs36
1 files changed, 28 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
index 24fe6b9..d0e514b 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
@@ -167,9 +167,8 @@ public abstract class BSLinkset
167 bool ret = false; 167 bool ret = false;
168 lock (m_linksetActivityLock) 168 lock (m_linksetActivityLock)
169 { 169 {
170 if (m_children.Contains(child)) 170 ret = m_children.Contains(child);
171 ret = true; 171 /* Safer version but the above should work
172 /*
173 foreach (BSPhysObject bp in m_children) 172 foreach (BSPhysObject bp in m_children)
174 { 173 {
175 if (child.LocalID == bp.LocalID) 174 if (child.LocalID == bp.LocalID)
@@ -183,6 +182,25 @@ public abstract class BSLinkset
183 return ret; 182 return ret;
184 } 183 }
185 184
185 // Perform an action on each member of the linkset including root prim.
186 // The action is performed only on the objects that are physically in the linkset.
187 // Depends on the action on whether this should be done at taint time.
188 public delegate bool ForEachMemberAction(BSPhysObject obj);
189 public virtual bool ForEachMember(ForEachMemberAction action)
190 {
191 bool ret = false;
192 lock (m_linksetActivityLock)
193 {
194 action(LinksetRoot);
195 foreach (BSPhysObject po in m_taintChildren)
196 {
197 if (action(po))
198 break;
199 }
200 }
201 return ret;
202 }
203
186 // When physical properties are changed the linkset needs to recalculate 204 // When physical properties are changed the linkset needs to recalculate
187 // its internal properties. 205 // its internal properties.
188 // May be called at runtime or taint-time (just pass the appropriate flag). 206 // May be called at runtime or taint-time (just pass the appropriate flag).
@@ -224,13 +242,15 @@ public abstract class BSLinkset
224 242
225 protected virtual float ComputeLinksetMass() 243 protected virtual float ComputeLinksetMass()
226 { 244 {
227 float mass; 245 float mass = LinksetRoot.MassRaw;
228 lock (m_linksetActivityLock) 246 if (HasAnyChildren)
229 { 247 {
230 mass = LinksetRoot.MassRaw; 248 lock (m_linksetActivityLock)
231 foreach (BSPhysObject bp in m_taintChildren)
232 { 249 {
233 mass += bp.MassRaw; 250 foreach (BSPhysObject bp in m_children)
251 {
252 mass += bp.MassRaw;
253 }
234 } 254 }
235 } 255 }
236 return mass; 256 return mass;