diff options
author | Robert Adams | 2012-08-10 08:33:09 -0700 |
---|---|---|
committer | Robert Adams | 2012-08-10 08:33:09 -0700 |
commit | 3ca770cd2c7705d53efe11bb2a2315392b1f492a (patch) | |
tree | b41bd864df05112aa0a13f4d63cdf2bad5b930e9 /OpenSim/Region/Physics/BulletSPlugin | |
parent | BulletSim: add an identifier to the TaintObject call so exceptions that happe... (diff) | |
download | opensim-SC-3ca770cd2c7705d53efe11bb2a2315392b1f492a.zip opensim-SC-3ca770cd2c7705d53efe11bb2a2315392b1f492a.tar.gz opensim-SC-3ca770cd2c7705d53efe11bb2a2315392b1f492a.tar.bz2 opensim-SC-3ca770cd2c7705d53efe11bb2a2315392b1f492a.tar.xz |
BulletSim: Add module names to DetailLog output. Fix some problems with linksets that were caused by checking data structures that are changed regularly from taint time code -- resulted in linksets not being unlinked properly.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 8 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | 57 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 69 |
3 files changed, 71 insertions, 63 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index d49a578..4f48cfb 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -248,7 +248,7 @@ public class BSCharacter : PhysicsActor | |||
248 | // m_log.DebugFormat("{0}: Force = {1}", LogHeader, _force); | 248 | // m_log.DebugFormat("{0}: Force = {1}", LogHeader, _force); |
249 | Scene.TaintedObject("BSCharacter.SetForce", delegate() | 249 | Scene.TaintedObject("BSCharacter.SetForce", delegate() |
250 | { | 250 | { |
251 | DetailLog("{0},setForce,taint,force={1}", LocalID, _force); | 251 | DetailLog("{0},BSCharacter.setForce,taint,force={1}", LocalID, _force); |
252 | BulletSimAPI.SetObjectForce(Scene.WorldID, LocalID, _force); | 252 | BulletSimAPI.SetObjectForce(Scene.WorldID, LocalID, _force); |
253 | }); | 253 | }); |
254 | } | 254 | } |
@@ -275,7 +275,7 @@ public class BSCharacter : PhysicsActor | |||
275 | // m_log.DebugFormat("{0}: set velocity = {1}", LogHeader, _velocity); | 275 | // m_log.DebugFormat("{0}: set velocity = {1}", LogHeader, _velocity); |
276 | _scene.TaintedObject("BSCharacter.setVelocity", delegate() | 276 | _scene.TaintedObject("BSCharacter.setVelocity", delegate() |
277 | { | 277 | { |
278 | DetailLog("{0},setVelocity,taint,vel={1}", LocalID, _velocity); | 278 | DetailLog("{0},BSCharacter.setVelocity,taint,vel={1}", LocalID, _velocity); |
279 | BulletSimAPI.SetObjectVelocity(_scene.WorldID, _localID, _velocity); | 279 | BulletSimAPI.SetObjectVelocity(_scene.WorldID, _localID, _velocity); |
280 | }); | 280 | }); |
281 | } | 281 | } |
@@ -487,6 +487,10 @@ public class BSCharacter : PhysicsActor | |||
487 | _rotationalVelocity = entprop.RotationalVelocity; | 487 | _rotationalVelocity = entprop.RotationalVelocity; |
488 | // Avatars don't report their changes the usual way. Changes are checked for in the heartbeat loop. | 488 | // Avatars don't report their changes the usual way. Changes are checked for in the heartbeat loop. |
489 | // base.RequestPhysicsterseUpdate(); | 489 | // base.RequestPhysicsterseUpdate(); |
490 | |||
491 | DetailLog("{0},BSCharacter.UpdateProperties,child,pos={1},orient={2},vel={3},accel={4},rotVel={5}", | ||
492 | LocalID, entprop.Position, entprop.Rotation, entprop.Velocity, | ||
493 | entprop.Acceleration, entprop.RotationalVelocity); | ||
490 | } | 494 | } |
491 | 495 | ||
492 | // Called by the scene when a collision with this object is reported | 496 | // Called by the scene when a collision with this object is reported |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs index bf262c5..f68e06e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | |||
@@ -40,9 +40,12 @@ public class BSLinkset | |||
40 | public BSPrim Root { get { return m_linksetRoot; } } | 40 | public BSPrim Root { get { return m_linksetRoot; } } |
41 | 41 | ||
42 | private BSScene m_scene; | 42 | private BSScene m_scene; |
43 | public BSScene Scene { get { return m_scene; } } | ||
43 | 44 | ||
44 | private List<BSPrim> m_children; | 45 | private List<BSPrim> m_children; |
45 | 46 | ||
47 | public int NumberOfChildren { get { return m_children.Count; } } | ||
48 | |||
46 | // We lock the diddling of linkset classes to prevent any badness. | 49 | // We lock the diddling of linkset classes to prevent any badness. |
47 | // This locks the modification of the instances of this class. Changes | 50 | // This locks the modification of the instances of this class. Changes |
48 | // to the physical representation is done via the tainting mechenism. | 51 | // to the physical representation is done via the tainting mechenism. |
@@ -113,9 +116,10 @@ public class BSLinkset | |||
113 | } | 116 | } |
114 | 117 | ||
115 | // The child is down to a linkset of just itself | 118 | // The child is down to a linkset of just itself |
116 | return new BSLinkset(m_scene, child); | 119 | return new BSLinkset(Scene, child); |
117 | } | 120 | } |
118 | 121 | ||
122 | /* DEPRECATED: this is really bad in that it trys to unlink other prims. | ||
119 | // An existing linkset had one of its members rebuilt or something. | 123 | // An existing linkset had one of its members rebuilt or something. |
120 | // Go through the linkset and rebuild the pointers to the bodies of the linkset members. | 124 | // Go through the linkset and rebuild the pointers to the bodies of the linkset members. |
121 | public BSLinkset RefreshLinkset(BSPrim requestor) | 125 | public BSLinkset RefreshLinkset(BSPrim requestor) |
@@ -163,6 +167,7 @@ public class BSLinkset | |||
163 | 167 | ||
164 | return ret; | 168 | return ret; |
165 | } | 169 | } |
170 | */ | ||
166 | 171 | ||
167 | 172 | ||
168 | // Return 'true' if the passed object is the root object of this linkset | 173 | // Return 'true' if the passed object is the root object of this linkset |
@@ -229,18 +234,19 @@ public class BSLinkset | |||
229 | } | 234 | } |
230 | 235 | ||
231 | // I am the root of a linkset and a new child is being added | 236 | // I am the root of a linkset and a new child is being added |
232 | public void AddChildToLinkset(BSPrim pchild) | 237 | // Called while LinkActivity is locked. |
238 | public void AddChildToLinkset(BSPrim child) | ||
233 | { | 239 | { |
234 | BSPrim child = pchild; | ||
235 | if (!HasChild(child)) | 240 | if (!HasChild(child)) |
236 | { | 241 | { |
237 | m_children.Add(child); | 242 | m_children.Add(child); |
238 | 243 | ||
244 | BSPrim root = Root; // capture the root as of now | ||
239 | m_scene.TaintedObject("AddChildToLinkset", delegate() | 245 | m_scene.TaintedObject("AddChildToLinkset", delegate() |
240 | { | 246 | { |
241 | DebugLog("{0}: AddChildToLinkset: adding child {1} to {2}", LogHeader, child.LocalID, m_linksetRoot.LocalID); | 247 | DebugLog("{0}: AddChildToLinkset: adding child {1} to {2}", LogHeader, child.LocalID, m_linksetRoot.LocalID); |
242 | DetailLog("{0},AddChildToLinkset,taint,child={1}", m_linksetRoot.LocalID, pchild.LocalID); | 248 | DetailLog("{0},AddChildToLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID); |
243 | PhysicallyLinkAChildToRoot(pchild); // build the physical binding between me and the child | 249 | PhysicallyLinkAChildToRoot(root, child); // build the physical binding between me and the child |
244 | }); | 250 | }); |
245 | } | 251 | } |
246 | return; | 252 | return; |
@@ -259,26 +265,17 @@ public class BSLinkset | |||
259 | 265 | ||
260 | // I am the root of a linkset and one of my children is being removed. | 266 | // I am the root of a linkset and one of my children is being removed. |
261 | // Safe to call even if the child is not really in my linkset. | 267 | // Safe to call even if the child is not really in my linkset. |
262 | public void RemoveChildFromLinkset(BSPrim pchild) | 268 | public void RemoveChildFromLinkset(BSPrim child) |
263 | { | 269 | { |
264 | BSPrim child = pchild; | ||
265 | |||
266 | if (m_children.Remove(child)) | 270 | if (m_children.Remove(child)) |
267 | { | 271 | { |
272 | BSPrim root = Root; // capture the root as of now | ||
268 | m_scene.TaintedObject("RemoveChildFromLinkset", delegate() | 273 | m_scene.TaintedObject("RemoveChildFromLinkset", delegate() |
269 | { | 274 | { |
270 | DebugLog("{0}: RemoveChildFromLinkset: Removing constraint to {1}", LogHeader, child.LocalID); | 275 | DebugLog("{0}: RemoveChildFromLinkset: Removing constraint to {1}", LogHeader, child.LocalID); |
271 | DetailLog("{0},RemoveChildFromLinkset,taint,child={1}", m_linksetRoot.LocalID, pchild.LocalID); | 276 | DetailLog("{0},RemoveChildFromLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID); |
272 | 277 | ||
273 | if (m_children.Count == 0) | 278 | PhysicallyUnlinkAChildFromRoot(root, child); |
274 | { | ||
275 | // if the linkset is empty, make sure all linkages have been removed | ||
276 | PhysicallyUnlinkAllChildrenFromRoot(); | ||
277 | } | ||
278 | else | ||
279 | { | ||
280 | PhysicallyUnlinkAChildFromRoot(pchild); | ||
281 | } | ||
282 | }); | 279 | }); |
283 | } | 280 | } |
284 | else | 281 | else |
@@ -291,14 +288,14 @@ public class BSLinkset | |||
291 | 288 | ||
292 | // Create a constraint between me (root of linkset) and the passed prim (the child). | 289 | // Create a constraint between me (root of linkset) and the passed prim (the child). |
293 | // Called at taint time! | 290 | // Called at taint time! |
294 | private void PhysicallyLinkAChildToRoot(BSPrim childPrim) | 291 | private void PhysicallyLinkAChildToRoot(BSPrim rootPrim, BSPrim childPrim) |
295 | { | 292 | { |
296 | // Zero motion for children so they don't interpolate | 293 | // Zero motion for children so they don't interpolate |
297 | childPrim.ZeroMotion(); | 294 | childPrim.ZeroMotion(); |
298 | 295 | ||
299 | // relative position normalized to the root prim | 296 | // relative position normalized to the root prim |
300 | OMV.Quaternion invThisOrientation = OMV.Quaternion.Inverse(m_linksetRoot.Orientation); | 297 | OMV.Quaternion invThisOrientation = OMV.Quaternion.Inverse(rootPrim.Orientation); |
301 | OMV.Vector3 childRelativePosition = (childPrim.Position - m_linksetRoot.Position) * invThisOrientation; | 298 | OMV.Vector3 childRelativePosition = (childPrim.Position - rootPrim.Position) * invThisOrientation; |
302 | 299 | ||
303 | // relative rotation of the child to the parent | 300 | // relative rotation of the child to the parent |
304 | OMV.Quaternion childRelativeRotation = invThisOrientation * childPrim.Orientation; | 301 | OMV.Quaternion childRelativeRotation = invThisOrientation * childPrim.Orientation; |
@@ -306,9 +303,9 @@ public class BSLinkset | |||
306 | // create a constraint that allows no freedom of movement between the two objects | 303 | // create a constraint that allows no freedom of movement between the two objects |
307 | // http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818 | 304 | // http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818 |
308 | // DebugLog("{0}: CreateLinkset: Adding a constraint between root prim {1} and child prim {2}", LogHeader, LocalID, childPrim.LocalID); | 305 | // DebugLog("{0}: CreateLinkset: Adding a constraint between root prim {1} and child prim {2}", LogHeader, LocalID, childPrim.LocalID); |
309 | DetailLog("{0},LinkAChildToMe,taint,root={1},child={2}", m_linksetRoot.LocalID, m_linksetRoot.LocalID, childPrim.LocalID); | 306 | DetailLog("{0},LinkAChildToMe,taint,root={1},child={2}", rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID); |
310 | BS6DofConstraint constrain = new BS6DofConstraint( | 307 | BS6DofConstraint constrain = new BS6DofConstraint( |
311 | m_scene.World, m_linksetRoot.Body, childPrim.Body, | 308 | m_scene.World, rootPrim.Body, childPrim.Body, |
312 | childRelativePosition, | 309 | childRelativePosition, |
313 | childRelativeRotation, | 310 | childRelativeRotation, |
314 | OMV.Vector3.Zero, | 311 | OMV.Vector3.Zero, |
@@ -331,25 +328,25 @@ public class BSLinkset | |||
331 | 328 | ||
332 | // Remove linkage between myself and a particular child | 329 | // Remove linkage between myself and a particular child |
333 | // Called at taint time! | 330 | // Called at taint time! |
334 | private void PhysicallyUnlinkAChildFromRoot(BSPrim childPrim) | 331 | private void PhysicallyUnlinkAChildFromRoot(BSPrim rootPrim, BSPrim childPrim) |
335 | { | 332 | { |
336 | // DebugLog("{0}: PhysicallyUnlinkAChildFromRoot: RemoveConstraint between root prim {1} and child prim {2}", | 333 | // DebugLog("{0}: PhysicallyUnlinkAChildFromRoot: RemoveConstraint between root prim {1} and child prim {2}", |
337 | // LogHeader, m_linksetRoot.LocalID, childPrim.LocalID); | 334 | // LogHeader, rootPrim.LocalID, childPrim.LocalID); |
338 | DetailLog("{0},PhysicallyUnlinkAChildFromRoot,taint,root={1},child={2}", m_linksetRoot.LocalID, m_linksetRoot.LocalID, childPrim.LocalID); | 335 | DetailLog("{0},PhysicallyUnlinkAChildFromRoot,taint,root={1},child={2}", rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID); |
339 | 336 | ||
340 | m_scene.Constraints.RemoveAndDestroyConstraint(m_linksetRoot.Body, childPrim.Body); | 337 | m_scene.Constraints.RemoveAndDestroyConstraint(rootPrim.Body, childPrim.Body); |
341 | // Make the child refresh its location | 338 | // Make the child refresh its location |
342 | BulletSimAPI.PushUpdate2(childPrim.Body.Ptr); | 339 | BulletSimAPI.PushUpdate2(childPrim.Body.Ptr); |
343 | } | 340 | } |
344 | 341 | ||
345 | // Remove linkage between myself and any possible children I might have | 342 | // Remove linkage between myself and any possible children I might have |
346 | // Called at taint time! | 343 | // Called at taint time! |
347 | private void PhysicallyUnlinkAllChildrenFromRoot() | 344 | private void PhysicallyUnlinkAllChildrenFromRoot(BSPrim rootPrim) |
348 | { | 345 | { |
349 | // DebugLog("{0}: PhysicallyUnlinkAllChildren:", LogHeader); | 346 | // DebugLog("{0}: PhysicallyUnlinkAllChildren:", LogHeader); |
350 | DetailLog("{0},PhysicallyUnlinkAllChildren,taint", m_linksetRoot.LocalID); | 347 | DetailLog("{0},PhysicallyUnlinkAllChildren,taint", rootPrim.LocalID); |
351 | 348 | ||
352 | m_scene.Constraints.RemoveAndDestroyConstraint(m_linksetRoot.Body); | 349 | m_scene.Constraints.RemoveAndDestroyConstraint(rootPrim.Body); |
353 | } | 350 | } |
354 | 351 | ||
355 | // Invoke the detailed logger and output something if it's enabled. | 352 | // Invoke the detailed logger and output something if it's enabled. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 988e03b..4193d22 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -160,16 +160,18 @@ public sealed class BSPrim : PhysicsActor | |||
160 | public void Destroy() | 160 | public void Destroy() |
161 | { | 161 | { |
162 | // m_log.DebugFormat("{0}: Destroy, id={1}", LogHeader, LocalID); | 162 | // m_log.DebugFormat("{0}: Destroy, id={1}", LogHeader, LocalID); |
163 | // DetailLog("{0},Destroy", LocalID); | 163 | // DetailLog("{0},BSPrim.Destroy", LocalID); |
164 | 164 | ||
165 | // Undo any vehicle properties | 165 | // Undo any vehicle properties |
166 | _vehicle.ProcessTypeChange(Vehicle.TYPE_NONE); | 166 | _vehicle.ProcessTypeChange(Vehicle.TYPE_NONE); |
167 | _scene.RemoveVehiclePrim(this); // just to make sure | 167 | _scene.RemoveVehiclePrim(this); // just to make sure |
168 | 168 | ||
169 | // Undo any links between me and any other object | ||
170 | _linkset = _linkset.RemoveMeFromLinkset(this); | ||
171 | |||
169 | _scene.TaintedObject("BSPrim.destroy", delegate() | 172 | _scene.TaintedObject("BSPrim.destroy", delegate() |
170 | { | 173 | { |
171 | // Undo any links between me and any other object | 174 | DetailLog("{0},BSPrim.Destroy,taint,", LocalID); |
172 | _linkset = _linkset.RemoveMeFromLinkset(this); | ||
173 | 175 | ||
174 | // everything in the C# world will get garbage collected. Tell the C++ world to free stuff. | 176 | // everything in the C# world will get garbage collected. Tell the C++ world to free stuff. |
175 | BulletSimAPI.DestroyObject(_scene.WorldID, LocalID); | 177 | BulletSimAPI.DestroyObject(_scene.WorldID, LocalID); |
@@ -187,7 +189,7 @@ public sealed class BSPrim : PhysicsActor | |||
187 | { | 189 | { |
188 | _mass = CalculateMass(); // changing size changes the mass | 190 | _mass = CalculateMass(); // changing size changes the mass |
189 | BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, (IsPhysical ? _mass : 0f), IsPhysical); | 191 | BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, (IsPhysical ? _mass : 0f), IsPhysical); |
190 | // DetailLog("{0}: setSize: size={1}, mass={2}, physical={3}", LocalID, _size, _mass, IsPhysical); | 192 | // DetailLog("{0}: BSPrim.setSize: size={1}, mass={2}, physical={3}", LocalID, _size, _mass, IsPhysical); |
191 | RecreateGeomAndObject(); | 193 | RecreateGeomAndObject(); |
192 | }); | 194 | }); |
193 | } | 195 | } |
@@ -227,7 +229,7 @@ public sealed class BSPrim : PhysicsActor | |||
227 | if (parent != null) | 229 | if (parent != null) |
228 | { | 230 | { |
229 | DebugLog("{0}: link {1}/{2} to {3}", LogHeader, _avName, _localID, parent.LocalID); | 231 | DebugLog("{0}: link {1}/{2} to {3}", LogHeader, _avName, _localID, parent.LocalID); |
230 | DetailLog("{0},link,parent={1}", LocalID, parent.LocalID); | 232 | DetailLog("{0},BSPrim.link,parent={1}", LocalID, parent.LocalID); |
231 | _linkset = _linkset.AddMeToLinkset(this, parent); | 233 | _linkset = _linkset.AddMeToLinkset(this, parent); |
232 | } | 234 | } |
233 | return; | 235 | return; |
@@ -239,9 +241,14 @@ public sealed class BSPrim : PhysicsActor | |||
239 | // Race condition here: if link() and delink() in same simulation tick, the delink will not happen | 241 | // Race condition here: if link() and delink() in same simulation tick, the delink will not happen |
240 | DebugLog("{0}: delink {1}/{2}. Parent={3}", LogHeader, _avName, _localID, | 242 | DebugLog("{0}: delink {1}/{2}. Parent={3}", LogHeader, _avName, _localID, |
241 | _linkset.Root._avName+"/"+_linkset.Root.LocalID.ToString()); | 243 | _linkset.Root._avName+"/"+_linkset.Root.LocalID.ToString()); |
242 | DetailLog("{0},delink,parent={1}", LocalID, _linkset.Root.LocalID.ToString()); | ||
243 | 244 | ||
244 | _linkset.RemoveMeFromLinkset(this); | 245 | BSPrim parentBefore = _linkset.Root; |
246 | int childrenBefore = _linkset.NumberOfChildren; | ||
247 | |||
248 | _linkset = _linkset.RemoveMeFromLinkset(this); | ||
249 | |||
250 | DetailLog("{0},BSPrim.delink,parentBefore={1},childrenBefore={2},parentAfter={3},childrenAfter={4}, ", | ||
251 | LocalID, parentBefore.LocalID, childrenBefore, _linkset.Root.LocalID, _linkset.NumberOfChildren); | ||
245 | return; | 252 | return; |
246 | } | 253 | } |
247 | 254 | ||
@@ -264,7 +271,7 @@ public sealed class BSPrim : PhysicsActor | |||
264 | 271 | ||
265 | public override void LockAngularMotion(OMV.Vector3 axis) | 272 | public override void LockAngularMotion(OMV.Vector3 axis) |
266 | { | 273 | { |
267 | DetailLog("{0},LockAngularMotion,call,axis={1}", LocalID, axis); | 274 | DetailLog("{0},BSPrim.LockAngularMotion,call,axis={1}", LocalID, axis); |
268 | return; | 275 | return; |
269 | } | 276 | } |
270 | 277 | ||
@@ -283,7 +290,7 @@ public sealed class BSPrim : PhysicsActor | |||
283 | // TODO: what does it mean to set the position of a child prim?? Rebuild the constraint? | 290 | // TODO: what does it mean to set the position of a child prim?? Rebuild the constraint? |
284 | _scene.TaintedObject("BSPrim.setPosition", delegate() | 291 | _scene.TaintedObject("BSPrim.setPosition", delegate() |
285 | { | 292 | { |
286 | DetailLog("{0},SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 293 | DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
287 | BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); | 294 | BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); |
288 | }); | 295 | }); |
289 | } | 296 | } |
@@ -320,7 +327,7 @@ public sealed class BSPrim : PhysicsActor | |||
320 | _force = value; | 327 | _force = value; |
321 | _scene.TaintedObject("BSPrim.setForce", delegate() | 328 | _scene.TaintedObject("BSPrim.setForce", delegate() |
322 | { | 329 | { |
323 | DetailLog("{0},setForce,taint,force={1}", LocalID, _force); | 330 | DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force); |
324 | // BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force); | 331 | // BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force); |
325 | BulletSimAPI.SetObjectForce2(Body.Ptr, _force); | 332 | BulletSimAPI.SetObjectForce2(Body.Ptr, _force); |
326 | }); | 333 | }); |
@@ -335,7 +342,7 @@ public sealed class BSPrim : PhysicsActor | |||
335 | Vehicle type = (Vehicle)value; | 342 | Vehicle type = (Vehicle)value; |
336 | _scene.TaintedObject("BSPrim.setVehicleType", delegate() | 343 | _scene.TaintedObject("BSPrim.setVehicleType", delegate() |
337 | { | 344 | { |
338 | DetailLog("{0},SetVehicleType,taint,type={1}", LocalID, type); | 345 | DetailLog("{0},BSPrim.SetVehicleType,taint,type={1}", LocalID, type); |
339 | _vehicle.ProcessTypeChange(type); | 346 | _vehicle.ProcessTypeChange(type); |
340 | if (type == Vehicle.TYPE_NONE) | 347 | if (type == Vehicle.TYPE_NONE) |
341 | { | 348 | { |
@@ -405,7 +412,7 @@ public sealed class BSPrim : PhysicsActor | |||
405 | _velocity = value; | 412 | _velocity = value; |
406 | _scene.TaintedObject("BSPrim.setVelocity", delegate() | 413 | _scene.TaintedObject("BSPrim.setVelocity", delegate() |
407 | { | 414 | { |
408 | DetailLog("{0},SetVelocity,taint,vel={1}", LocalID, _velocity); | 415 | DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity); |
409 | BulletSimAPI.SetObjectVelocity(_scene.WorldID, LocalID, _velocity); | 416 | BulletSimAPI.SetObjectVelocity(_scene.WorldID, LocalID, _velocity); |
410 | }); | 417 | }); |
411 | } | 418 | } |
@@ -413,7 +420,7 @@ public sealed class BSPrim : PhysicsActor | |||
413 | public override OMV.Vector3 Torque { | 420 | public override OMV.Vector3 Torque { |
414 | get { return _torque; } | 421 | get { return _torque; } |
415 | set { _torque = value; | 422 | set { _torque = value; |
416 | DetailLog("{0},SetTorque,call,torque={1}", LocalID, _torque); | 423 | DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque); |
417 | } | 424 | } |
418 | } | 425 | } |
419 | public override float CollisionScore { | 426 | public override float CollisionScore { |
@@ -440,7 +447,7 @@ public sealed class BSPrim : PhysicsActor | |||
440 | _scene.TaintedObject("BSPrim.setOrientation", delegate() | 447 | _scene.TaintedObject("BSPrim.setOrientation", delegate() |
441 | { | 448 | { |
442 | // _position = BulletSimAPI.GetObjectPosition(_scene.WorldID, _localID); | 449 | // _position = BulletSimAPI.GetObjectPosition(_scene.WorldID, _localID); |
443 | DetailLog("{0},setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 450 | DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
444 | BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); | 451 | BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); |
445 | }); | 452 | }); |
446 | } | 453 | } |
@@ -486,7 +493,7 @@ public sealed class BSPrim : PhysicsActor | |||
486 | // Bullet wants static objects to have a mass of zero | 493 | // Bullet wants static objects to have a mass of zero |
487 | float mass = IsStatic ? 0f : _mass; | 494 | float mass = IsStatic ? 0f : _mass; |
488 | 495 | ||
489 | DetailLog("{0},SetObjectDynamic,taint,static={1},solid={2},mass={3}", LocalID, IsStatic, IsSolid, mass); | 496 | DetailLog("{0},BSPrim.SetObjectDynamic,taint,static={1},solid={2},mass={3}", LocalID, IsStatic, IsSolid, mass); |
490 | BulletSimAPI.SetObjectProperties(_scene.WorldID, LocalID, IsStatic, IsSolid, SubscribedEvents(), mass); | 497 | BulletSimAPI.SetObjectProperties(_scene.WorldID, LocalID, IsStatic, IsSolid, SubscribedEvents(), mass); |
491 | } | 498 | } |
492 | 499 | ||
@@ -544,7 +551,7 @@ public sealed class BSPrim : PhysicsActor | |||
544 | // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); | 551 | // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); |
545 | _scene.TaintedObject("BSPrim.setRotationalVelocity", delegate() | 552 | _scene.TaintedObject("BSPrim.setRotationalVelocity", delegate() |
546 | { | 553 | { |
547 | DetailLog("{0},SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); | 554 | DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); |
548 | BulletSimAPI.SetObjectAngularVelocity(_scene.WorldID, LocalID, _rotationalVelocity); | 555 | BulletSimAPI.SetObjectAngularVelocity(_scene.WorldID, LocalID, _rotationalVelocity); |
549 | }); | 556 | }); |
550 | } | 557 | } |
@@ -561,7 +568,7 @@ public sealed class BSPrim : PhysicsActor | |||
561 | _buoyancy = value; | 568 | _buoyancy = value; |
562 | _scene.TaintedObject("BSPrim.setBuoyancy", delegate() | 569 | _scene.TaintedObject("BSPrim.setBuoyancy", delegate() |
563 | { | 570 | { |
564 | DetailLog("{0},SetBuoyancy,taint,buoy={1}", LocalID, _buoyancy); | 571 | DetailLog("{0},BSPrim.SetBuoyancy,taint,buoy={1}", LocalID, _buoyancy); |
565 | BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, _localID, _buoyancy); | 572 | BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, _localID, _buoyancy); |
566 | }); | 573 | }); |
567 | } | 574 | } |
@@ -624,17 +631,17 @@ public sealed class BSPrim : PhysicsActor | |||
624 | } | 631 | } |
625 | m_accumulatedForces.Clear(); | 632 | m_accumulatedForces.Clear(); |
626 | } | 633 | } |
627 | DetailLog("{0},AddObjectForce,taint,force={1}", LocalID, _force); | 634 | DetailLog("{0},BSPrim.AddObjectForce,taint,force={1}", LocalID, _force); |
628 | BulletSimAPI.AddObjectForce2(Body.Ptr, fSum); | 635 | BulletSimAPI.AddObjectForce2(Body.Ptr, fSum); |
629 | }); | 636 | }); |
630 | } | 637 | } |
631 | 638 | ||
632 | public override void AddAngularForce(OMV.Vector3 force, bool pushforce) { | 639 | public override void AddAngularForce(OMV.Vector3 force, bool pushforce) { |
633 | DetailLog("{0},AddAngularForce,call,angForce={1},push={2}", LocalID, force, pushforce); | 640 | DetailLog("{0},BSPrim.AddAngularForce,call,angForce={1},push={2}", LocalID, force, pushforce); |
634 | // m_log.DebugFormat("{0}: AddAngularForce. f={1}, push={2}", LogHeader, force, pushforce); | 641 | // m_log.DebugFormat("{0}: AddAngularForce. f={1}, push={2}", LogHeader, force, pushforce); |
635 | } | 642 | } |
636 | public override void SetMomentum(OMV.Vector3 momentum) { | 643 | public override void SetMomentum(OMV.Vector3 momentum) { |
637 | DetailLog("{0},SetMomentum,call,mom={1}", LocalID, momentum); | 644 | DetailLog("{0},BSPrim.SetMomentum,call,mom={1}", LocalID, momentum); |
638 | } | 645 | } |
639 | public override void SubscribeEvents(int ms) { | 646 | public override void SubscribeEvents(int ms) { |
640 | _subscribedEventsMs = ms; | 647 | _subscribedEventsMs = ms; |
@@ -978,7 +985,7 @@ public sealed class BSPrim : PhysicsActor | |||
978 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size); | 985 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size); |
979 | if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE)) | 986 | if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE)) |
980 | { | 987 | { |
981 | DetailLog("{0},CreateGeom,sphere (force={1}", LocalID, forceRebuild); | 988 | DetailLog("{0},BSPrim.CreateGeom,sphere (force={1}", LocalID, forceRebuild); |
982 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE; | 989 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE; |
983 | // Bullet native objects are scaled by the Bullet engine so pass the size in | 990 | // Bullet native objects are scaled by the Bullet engine so pass the size in |
984 | _scale = _size; | 991 | _scale = _size; |
@@ -992,7 +999,7 @@ public sealed class BSPrim : PhysicsActor | |||
992 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, type={2}, size={3}", LogHeader, LocalID, _shapeType, _size); | 999 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, type={2}, size={3}", LogHeader, LocalID, _shapeType, _size); |
993 | if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_BOX)) | 1000 | if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_BOX)) |
994 | { | 1001 | { |
995 | DetailLog("{0},CreateGeom,box (force={1})", LocalID, forceRebuild); | 1002 | DetailLog("{0},BSPrim.CreateGeom,box (force={1})", LocalID, forceRebuild); |
996 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX; | 1003 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX; |
997 | _scale = _size; | 1004 | _scale = _size; |
998 | // TODO: do we need to check for and destroy a mesh or hull that might have been left from before? | 1005 | // TODO: do we need to check for and destroy a mesh or hull that might have been left from before? |
@@ -1035,12 +1042,12 @@ public sealed class BSPrim : PhysicsActor | |||
1035 | // if this new shape is the same as last time, don't recreate the mesh | 1042 | // if this new shape is the same as last time, don't recreate the mesh |
1036 | if (_meshKey == newMeshKey) return; | 1043 | if (_meshKey == newMeshKey) return; |
1037 | 1044 | ||
1038 | DetailLog("{0},CreateGeomMesh,create,key={1}", LocalID, newMeshKey); | 1045 | DetailLog("{0},BSPrim.CreateGeomMesh,create,key={1}", LocalID, newMeshKey); |
1039 | // Since we're recreating new, get rid of any previously generated shape | 1046 | // Since we're recreating new, get rid of any previously generated shape |
1040 | if (_meshKey != 0) | 1047 | if (_meshKey != 0) |
1041 | { | 1048 | { |
1042 | // m_log.DebugFormat("{0}: CreateGeom: deleting old mesh. lID={1}, Key={2}", LogHeader, _localID, _meshKey); | 1049 | // m_log.DebugFormat("{0}: CreateGeom: deleting old mesh. lID={1}, Key={2}", LogHeader, _localID, _meshKey); |
1043 | DetailLog("{0},CreateGeomMesh,deleteOld,key={1}", LocalID, _meshKey); | 1050 | DetailLog("{0},BSPrim.CreateGeomMesh,deleteOld,key={1}", LocalID, _meshKey); |
1044 | BulletSimAPI.DestroyMesh(_scene.WorldID, _meshKey); | 1051 | BulletSimAPI.DestroyMesh(_scene.WorldID, _meshKey); |
1045 | _mesh = null; | 1052 | _mesh = null; |
1046 | _meshKey = 0; | 1053 | _meshKey = 0; |
@@ -1070,7 +1077,7 @@ public sealed class BSPrim : PhysicsActor | |||
1070 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_MESH; | 1077 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_MESH; |
1071 | // meshes are already scaled by the meshmerizer | 1078 | // meshes are already scaled by the meshmerizer |
1072 | _scale = new OMV.Vector3(1f, 1f, 1f); | 1079 | _scale = new OMV.Vector3(1f, 1f, 1f); |
1073 | DetailLog("{0},CreateGeomMesh,done", LocalID); | 1080 | DetailLog("{0},BSPrim.CreateGeomMesh,done", LocalID); |
1074 | return; | 1081 | return; |
1075 | } | 1082 | } |
1076 | 1083 | ||
@@ -1084,17 +1091,17 @@ public sealed class BSPrim : PhysicsActor | |||
1084 | // if the hull hasn't changed, don't rebuild it | 1091 | // if the hull hasn't changed, don't rebuild it |
1085 | if (newHullKey == _hullKey) return; | 1092 | if (newHullKey == _hullKey) return; |
1086 | 1093 | ||
1087 | DetailLog("{0},CreateGeomHull,create,key={1}", LocalID, _meshKey); | 1094 | DetailLog("{0},BSPrim.CreateGeomHull,create,key={1}", LocalID, _meshKey); |
1088 | 1095 | ||
1089 | // Since we're recreating new, get rid of any previously generated shape | 1096 | // Since we're recreating new, get rid of any previously generated shape |
1090 | if (_hullKey != 0) | 1097 | if (_hullKey != 0) |
1091 | { | 1098 | { |
1092 | // m_log.DebugFormat("{0}: CreateGeom: deleting old hull. Key={1}", LogHeader, _hullKey); | 1099 | // m_log.DebugFormat("{0}: CreateGeom: deleting old hull. Key={1}", LogHeader, _hullKey); |
1093 | DetailLog("{0},CreateGeomHull,deleteOldHull,key={1}", LocalID, _meshKey); | 1100 | DetailLog("{0},BSPrim.CreateGeomHull,deleteOldHull,key={1}", LocalID, _meshKey); |
1094 | BulletSimAPI.DestroyHull(_scene.WorldID, _hullKey); | 1101 | BulletSimAPI.DestroyHull(_scene.WorldID, _hullKey); |
1095 | _hullKey = 0; | 1102 | _hullKey = 0; |
1096 | _hulls.Clear(); | 1103 | _hulls.Clear(); |
1097 | DetailLog("{0},CreateGeomHull,deleteOldMesh,key={1}", LocalID, _meshKey); | 1104 | DetailLog("{0},BSPrim.CreateGeomHull,deleteOldMesh,key={1}", LocalID, _meshKey); |
1098 | BulletSimAPI.DestroyMesh(_scene.WorldID, _meshKey); | 1105 | BulletSimAPI.DestroyMesh(_scene.WorldID, _meshKey); |
1099 | _mesh = null; // the mesh cannot match either | 1106 | _mesh = null; // the mesh cannot match either |
1100 | _meshKey = 0; | 1107 | _meshKey = 0; |
@@ -1191,7 +1198,7 @@ public sealed class BSPrim : PhysicsActor | |||
1191 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_HULL; | 1198 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_HULL; |
1192 | // meshes are already scaled by the meshmerizer | 1199 | // meshes are already scaled by the meshmerizer |
1193 | _scale = new OMV.Vector3(1f, 1f, 1f); | 1200 | _scale = new OMV.Vector3(1f, 1f, 1f); |
1194 | DetailLog("{0},CreateGeomHull,done", LocalID); | 1201 | DetailLog("{0},BSPrim.CreateGeomHull,done", LocalID); |
1195 | return; | 1202 | return; |
1196 | } | 1203 | } |
1197 | 1204 | ||
@@ -1329,7 +1336,7 @@ public sealed class BSPrim : PhysicsActor | |||
1329 | 1336 | ||
1330 | // m_log.DebugFormat("{0}: RequestTerseUpdate. id={1}, ch={2}, pos={3}, rot={4}, vel={5}, acc={6}, rvel={7}", | 1337 | // m_log.DebugFormat("{0}: RequestTerseUpdate. id={1}, ch={2}, pos={3}, rot={4}, vel={5}, acc={6}, rvel={7}", |
1331 | // LogHeader, LocalID, changed, _position, _orientation, _velocity, _acceleration, _rotationalVelocity); | 1338 | // LogHeader, LocalID, changed, _position, _orientation, _velocity, _acceleration, _rotationalVelocity); |
1332 | DetailLog("{0},UpdateProperties,call,pos={1},orient={2},vel={3},accel={4},rotVel={5}", | 1339 | DetailLog("{0},BSPrim.UpdateProperties,call,pos={1},orient={2},vel={3},accel={4},rotVel={5}", |
1333 | LocalID, _position, _orientation, _velocity, _acceleration, _rotationalVelocity); | 1340 | LocalID, _position, _orientation, _velocity, _acceleration, _rotationalVelocity); |
1334 | 1341 | ||
1335 | base.RequestPhysicsterseUpdate(); | 1342 | base.RequestPhysicsterseUpdate(); |
@@ -1337,7 +1344,7 @@ public sealed class BSPrim : PhysicsActor | |||
1337 | else | 1344 | else |
1338 | { | 1345 | { |
1339 | // For debugging, we also report the movement of children | 1346 | // For debugging, we also report the movement of children |
1340 | DetailLog("{0},UpdateProperties,child,pos={1},orient={2},vel={3},accel={4},rotVel={5}", | 1347 | DetailLog("{0},BSPrim.BSPrim.UpdateProperties,child,pos={1},orient={2},vel={3},accel={4},rotVel={5}", |
1341 | LocalID, entprop.Position, entprop.Rotation, entprop.Velocity, | 1348 | LocalID, entprop.Position, entprop.Rotation, entprop.Velocity, |
1342 | entprop.Acceleration, entprop.RotationalVelocity); | 1349 | entprop.Acceleration, entprop.RotationalVelocity); |
1343 | } | 1350 | } |