diff options
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | 55 |
1 files changed, 37 insertions, 18 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs index 20db4de..b84ccdc 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | |||
@@ -160,6 +160,31 @@ public class BSLinkset | |||
160 | return ret; | 160 | return ret; |
161 | } | 161 | } |
162 | 162 | ||
163 | // When physical properties are changed the linkset needs to recalculate | ||
164 | // its internal properties. | ||
165 | // May be called at runtime or taint-time (just pass the appropriate flag). | ||
166 | public void Refresh(BSPhysObject requestor, bool inTaintTime) | ||
167 | { | ||
168 | // If there are no children, there can't be any constraints to recompute | ||
169 | if (!HasAnyChildren) | ||
170 | return; | ||
171 | |||
172 | // Only the root does the recomputation | ||
173 | if (IsRoot(requestor)) | ||
174 | { | ||
175 | BSScene.TaintCallback refreshOperation = delegate() | ||
176 | { | ||
177 | RecomputeLinksetConstraintVariables(); | ||
178 | DetailLog("{0},BSLinkset.Refresh,complete,rBody={1}", | ||
179 | LinksetRoot.LocalID, LinksetRoot.BSBody.ptr.ToString("X")); | ||
180 | }; | ||
181 | if (inTaintTime) | ||
182 | refreshOperation(); | ||
183 | else | ||
184 | PhysicsScene.TaintedObject("BSLinkSet.Refresh", refreshOperation); | ||
185 | } | ||
186 | } | ||
187 | |||
163 | // The object is going dynamic (physical). Do any setup necessary | 188 | // The object is going dynamic (physical). Do any setup necessary |
164 | // for a dynamic linkset. | 189 | // for a dynamic linkset. |
165 | // Only the state of the passed object can be modified. The rest of the linkset | 190 | // Only the state of the passed object can be modified. The rest of the linkset |
@@ -182,24 +207,19 @@ public class BSLinkset | |||
182 | return false; | 207 | return false; |
183 | } | 208 | } |
184 | 209 | ||
185 | // When physical properties are changed the linkset needs to recalculate | 210 | // If the software is handling the movement of all the objects in a linkset |
186 | // its internal properties. | 211 | // (like if one doesn't use constraints for static linksets), this is called |
187 | // Called at runtime. | 212 | // when an update for the root of the linkset is received. |
188 | public void Refresh(BSPhysObject requestor) | 213 | // Called at taint-time!! |
214 | public void UpdateProperties(BSPhysObject physObject) | ||
189 | { | 215 | { |
190 | // If there are no children, there can't be any constraints to recompute | 216 | // The root local properties have been updated. Apply to the children if appropriate. |
191 | if (!HasAnyChildren) | 217 | if (IsRoot(physObject) && HasAnyChildren) |
192 | return; | ||
193 | |||
194 | // Only the root does the recomputation | ||
195 | if (IsRoot(requestor)) | ||
196 | { | 218 | { |
197 | PhysicsScene.TaintedObject("BSLinkSet.Refresh", delegate() | 219 | if (!physObject.IsPhysical) |
198 | { | 220 | { |
199 | RecomputeLinksetConstraintVariables(); | 221 | // TODO: implement software linkset update for static object linksets |
200 | DetailLog("{0},BSLinkset.Refresh,complete,rBody={1}", | 222 | } |
201 | LinksetRoot.LocalID, LinksetRoot.BSBody.ptr.ToString("X")); | ||
202 | }); | ||
203 | } | 223 | } |
204 | } | 224 | } |
205 | 225 | ||
@@ -236,9 +256,8 @@ public class BSLinkset | |||
236 | return ret; | 256 | return ret; |
237 | } | 257 | } |
238 | 258 | ||
239 | // Routine used when rebuilding the body of the root of the linkset | 259 | // Companion to RemoveBodyDependencies(). If RemoveBodyDependencies() returns 'true', |
240 | // This is called after RemoveAllLinksToRoot() to restore all the constraints. | 260 | // this routine will restore the removed constraints. |
241 | // This is called when the root body has been changed. | ||
242 | // Called at taint-time!! | 261 | // Called at taint-time!! |
243 | public void RestoreBodyDependencies(BSPrim child) | 262 | public void RestoreBodyDependencies(BSPrim child) |
244 | { | 263 | { |