diff options
author | Robert Adams | 2012-12-27 10:09:31 -0800 |
---|---|---|
committer | Robert Adams | 2012-12-27 22:12:26 -0800 |
commit | 723099067976dfa71d18182378000df144d618af (patch) | |
tree | 63509d119f289fb6fb614cd6cb52e5eaacd11538 | |
parent | BulletSim: add physical parameter min/max constants in BSParam. I just don't ... (diff) | |
download | opensim-SC-723099067976dfa71d18182378000df144d618af.zip opensim-SC-723099067976dfa71d18182378000df144d618af.tar.gz opensim-SC-723099067976dfa71d18182378000df144d618af.tar.bz2 opensim-SC-723099067976dfa71d18182378000df144d618af.tar.xz |
BulletSim: fix odd code that wasn't really recomputing the mass of a
rebuilt linkset. I was burnt by making get/set methods with side
effects. I should know better.
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index d5cbf5f..4e02904 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -98,11 +98,12 @@ public sealed class BSLinksetCompound : BSLinkset | |||
98 | // Schedule a refresh to happen after all the other taint processing. | 98 | // Schedule a refresh to happen after all the other taint processing. |
99 | private void ScheduleRebuild(BSPhysObject requestor) | 99 | private void ScheduleRebuild(BSPhysObject requestor) |
100 | { | 100 | { |
101 | DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1}", | 101 | DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1},hasChildren={2}", |
102 | requestor.LocalID, Rebuilding); | 102 | requestor.LocalID, Rebuilding, HasAnyChildren); |
103 | // 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. |
104 | // If already rebuilding, don't request another rebuild. | 104 | // If already rebuilding, don't request another rebuild. |
105 | if (!Rebuilding) | 105 | // If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding. |
106 | if (!Rebuilding && HasAnyChildren) | ||
106 | { | 107 | { |
107 | PhysicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate() | 108 | PhysicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate() |
108 | { | 109 | { |
@@ -112,8 +113,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
112 | } | 113 | } |
113 | } | 114 | } |
114 | 115 | ||
115 | // The object is going dynamic (physical). Do any setup necessary | 116 | // The object is going dynamic (physical). Do any setup necessary for a dynamic linkset. |
116 | // for a dynamic linkset. | ||
117 | // Only the state of the passed object can be modified. The rest of the linkset | 117 | // Only the state of the passed object can be modified. The rest of the linkset |
118 | // has not yet been fully constructed. | 118 | // has not yet been fully constructed. |
119 | // Return 'true' if any properties updated on the passed object. | 119 | // Return 'true' if any properties updated on the passed object. |
@@ -124,7 +124,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
124 | DetailLog("{0},BSLinksetCompound.MakeDynamic,call,IsRoot={1}", child.LocalID, IsRoot(child)); | 124 | DetailLog("{0},BSLinksetCompound.MakeDynamic,call,IsRoot={1}", child.LocalID, IsRoot(child)); |
125 | if (IsRoot(child)) | 125 | if (IsRoot(child)) |
126 | { | 126 | { |
127 | // The root is going dynamic. Make sure mass is properly set. | 127 | // The root is going dynamic. Rebuild the linkset so parts and mass get computed properly. |
128 | ScheduleRebuild(LinksetRoot); | 128 | ScheduleRebuild(LinksetRoot); |
129 | } | 129 | } |
130 | else | 130 | else |
@@ -378,7 +378,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
378 | }); | 378 | }); |
379 | 379 | ||
380 | // 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. |
381 | LinksetMass = LinksetMass; | 381 | LinksetMass = ComputeLinksetMass(); |
382 | LinksetRoot.UpdatePhysicalMassProperties(LinksetMass, true); | 382 | LinksetRoot.UpdatePhysicalMassProperties(LinksetMass, true); |
383 | } | 383 | } |
384 | finally | 384 | finally |