diff options
author | Robert Adams | 2012-08-17 13:30:46 -0700 |
---|---|---|
committer | Robert Adams | 2012-08-17 13:34:22 -0700 |
commit | 03d76e94034bbaa82d1872284d1fadbaa263411d (patch) | |
tree | 1671d1481282e0fb64d609b4be8d82a2faf78c0f /OpenSim/Region/Physics/BulletSPlugin | |
parent | Modify order of code so SOP doesn't set the physics actor flying (diff) | |
download | opensim-SC-03d76e94034bbaa82d1872284d1fadbaa263411d.zip opensim-SC-03d76e94034bbaa82d1872284d1fadbaa263411d.tar.gz opensim-SC-03d76e94034bbaa82d1872284d1fadbaa263411d.tar.bz2 opensim-SC-03d76e94034bbaa82d1872284d1fadbaa263411d.tar.xz |
BulletSim: restore most of the Detail logging statements. Will have
no effect on non-logging running.
Capture region name that is passed to the physics engine and use
it for detail logging file name prefix.
Fix problem with avatars dropping when flying across region boundries.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 21 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 46 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 16 |
4 files changed, 51 insertions, 40 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index e2f7af9..1b23a36 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -124,10 +124,14 @@ public class BSCharacter : PhysicsActor | |||
124 | // do actual create at taint time | 124 | // do actual create at taint time |
125 | _scene.TaintedObject("BSCharacter.create", delegate() | 125 | _scene.TaintedObject("BSCharacter.create", delegate() |
126 | { | 126 | { |
127 | DetailLog("{0},BSCharacter.create", _localID); | ||
127 | BulletSimAPI.CreateObject(parent_scene.WorldID, shapeData); | 128 | BulletSimAPI.CreateObject(parent_scene.WorldID, shapeData); |
128 | 129 | ||
130 | // Set the buoyancy for flying. This will be refactored when all the settings happen in C# | ||
131 | BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, LocalID, _buoyancy); | ||
132 | |||
129 | m_body = new BulletBody(LocalID, BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID)); | 133 | m_body = new BulletBody(LocalID, BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID)); |
130 | // avatars get all collisions no matter what | 134 | // avatars get all collisions no matter what (makes walking on ground and such work) |
131 | BulletSimAPI.AddToCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | 135 | BulletSimAPI.AddToCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); |
132 | }); | 136 | }); |
133 | 137 | ||
@@ -137,7 +141,7 @@ public class BSCharacter : PhysicsActor | |||
137 | // called when this character is being destroyed and the resources should be released | 141 | // called when this character is being destroyed and the resources should be released |
138 | public void Destroy() | 142 | public void Destroy() |
139 | { | 143 | { |
140 | // DetailLog("{0},BSCharacter.Destroy", LocalID); | 144 | DetailLog("{0},BSCharacter.Destroy", LocalID); |
141 | _scene.TaintedObject("BSCharacter.destroy", delegate() | 145 | _scene.TaintedObject("BSCharacter.destroy", delegate() |
142 | { | 146 | { |
143 | BulletSimAPI.DestroyObject(_scene.WorldID, _localID); | 147 | BulletSimAPI.DestroyObject(_scene.WorldID, _localID); |
@@ -319,14 +323,13 @@ public class BSCharacter : PhysicsActor | |||
319 | public override bool Flying { | 323 | public override bool Flying { |
320 | get { return _flying; } | 324 | get { return _flying; } |
321 | set { | 325 | set { |
322 | if (_flying != value) | 326 | _flying = value; |
323 | { | 327 | // simulate flying by changing the effect of gravity |
324 | _flying = value; | 328 | this.Buoyancy = ComputeBuoyancyFromFlying(_flying); |
325 | // simulate flying by changing the effect of gravity | ||
326 | this.Buoyancy = ComputeBuoyancyFromFlying(_flying); | ||
327 | } | ||
328 | } | 329 | } |
329 | } | 330 | } |
331 | // Flying is implimented by changing the avatar's buoyancy. | ||
332 | // Would this be done better with a vehicle type? | ||
330 | private float ComputeBuoyancyFromFlying(bool ifFlying) { | 333 | private float ComputeBuoyancyFromFlying(bool ifFlying) { |
331 | return ifFlying ? 1f : 0f; | 334 | return ifFlying ? 1f : 0f; |
332 | } | 335 | } |
@@ -488,11 +491,9 @@ public class BSCharacter : PhysicsActor | |||
488 | // Avatars don't report their changes the usual way. Changes are checked for in the heartbeat loop. | 491 | // Avatars don't report their changes the usual way. Changes are checked for in the heartbeat loop. |
489 | // base.RequestPhysicsterseUpdate(); | 492 | // base.RequestPhysicsterseUpdate(); |
490 | 493 | ||
491 | /* | ||
492 | DetailLog("{0},BSCharacter.UpdateProperties,call,pos={1},orient={2},vel={3},accel={4},rotVel={5}", | 494 | DetailLog("{0},BSCharacter.UpdateProperties,call,pos={1},orient={2},vel={3},accel={4},rotVel={5}", |
493 | LocalID, entprop.Position, entprop.Rotation, entprop.Velocity, | 495 | LocalID, entprop.Position, entprop.Rotation, entprop.Velocity, |
494 | entprop.Acceleration, entprop.RotationalVelocity); | 496 | entprop.Acceleration, entprop.RotationalVelocity); |
495 | */ | ||
496 | } | 497 | } |
497 | 498 | ||
498 | // Called by the scene when a collision with this object is reported | 499 | // 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 a075995..9e3f0db 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | |||
@@ -265,7 +265,7 @@ public class BSLinkset | |||
265 | BSPrim childx = child; | 265 | BSPrim childx = child; |
266 | m_physicsScene.TaintedObject("AddChildToLinkset", delegate() | 266 | m_physicsScene.TaintedObject("AddChildToLinkset", delegate() |
267 | { | 267 | { |
268 | // DetailLog("{0},AddChildToLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID); | 268 | DetailLog("{0},AddChildToLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID); |
269 | PhysicallyLinkAChildToRoot(rootx, childx); // build the physical binding between me and the child | 269 | PhysicallyLinkAChildToRoot(rootx, childx); // build the physical binding between me and the child |
270 | }); | 270 | }); |
271 | } | 271 | } |
@@ -293,7 +293,7 @@ public class BSLinkset | |||
293 | BSPrim childx = child; | 293 | BSPrim childx = child; |
294 | m_physicsScene.TaintedObject("RemoveChildFromLinkset", delegate() | 294 | m_physicsScene.TaintedObject("RemoveChildFromLinkset", delegate() |
295 | { | 295 | { |
296 | // DetailLog("{0},RemoveChildFromLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID); | 296 | DetailLog("{0},RemoveChildFromLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID); |
297 | 297 | ||
298 | PhysicallyUnlinkAChildFromRoot(rootx, childx); | 298 | PhysicallyUnlinkAChildFromRoot(rootx, childx); |
299 | }); | 299 | }); |
@@ -332,10 +332,10 @@ public class BSLinkset | |||
332 | true, | 332 | true, |
333 | true | 333 | true |
334 | ); | 334 | ); |
335 | /* NOTE: attempt to build constraint with full frame computation, etc. | 335 | /* NOTE: below is an attempt to build constraint with full frame computation, etc. |
336 | * Using the midpoint is easier since it lets the Bullet code use the transforms | 336 | * Using the midpoint is easier since it lets the Bullet code use the transforms |
337 | * of the objects. | 337 | * of the objects. |
338 | * Code left here as an example. | 338 | * Code left as a warning to future programmers. |
339 | // ================================================================================== | 339 | // ================================================================================== |
340 | // relative position normalized to the root prim | 340 | // relative position normalized to the root prim |
341 | OMV.Quaternion invThisOrientation = OMV.Quaternion.Inverse(rootPrim.Orientation); | 341 | OMV.Quaternion invThisOrientation = OMV.Quaternion.Inverse(rootPrim.Orientation); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 48cd89b..a6bc8e2 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -191,7 +191,7 @@ public sealed class BSPrim : PhysicsActor | |||
191 | { | 191 | { |
192 | _mass = CalculateMass(); // changing size changes the mass | 192 | _mass = CalculateMass(); // changing size changes the mass |
193 | BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, (IsPhysical ? _mass : 0f), IsPhysical); | 193 | BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, (IsPhysical ? _mass : 0f), IsPhysical); |
194 | // DetailLog("{0}: BSPrim.setSize: size={1}, mass={2}, physical={3}", LocalID, _size, _mass, IsPhysical); | 194 | DetailLog("{0}: BSPrim.setSize: size={1}, mass={2}, physical={3}", LocalID, _size, _mass, IsPhysical); |
195 | RecreateGeomAndObject(); | 195 | RecreateGeomAndObject(); |
196 | }); | 196 | }); |
197 | } | 197 | } |
@@ -275,7 +275,7 @@ public sealed class BSPrim : PhysicsActor | |||
275 | 275 | ||
276 | public override void LockAngularMotion(OMV.Vector3 axis) | 276 | public override void LockAngularMotion(OMV.Vector3 axis) |
277 | { | 277 | { |
278 | // DetailLog("{0},BSPrim.LockAngularMotion,call,axis={1}", LocalID, axis); | 278 | DetailLog("{0},BSPrim.LockAngularMotion,call,axis={1}", LocalID, axis); |
279 | return; | 279 | return; |
280 | } | 280 | } |
281 | 281 | ||
@@ -294,7 +294,7 @@ public sealed class BSPrim : PhysicsActor | |||
294 | // TODO: what does it mean to set the position of a child prim?? Rebuild the constraint? | 294 | // TODO: what does it mean to set the position of a child prim?? Rebuild the constraint? |
295 | _scene.TaintedObject("BSPrim.setPosition", delegate() | 295 | _scene.TaintedObject("BSPrim.setPosition", delegate() |
296 | { | 296 | { |
297 | // DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 297 | DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
298 | BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); | 298 | BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); |
299 | }); | 299 | }); |
300 | } | 300 | } |
@@ -331,7 +331,7 @@ public sealed class BSPrim : PhysicsActor | |||
331 | _force = value; | 331 | _force = value; |
332 | _scene.TaintedObject("BSPrim.setForce", delegate() | 332 | _scene.TaintedObject("BSPrim.setForce", delegate() |
333 | { | 333 | { |
334 | // DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force); | 334 | DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force); |
335 | // BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force); | 335 | // BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force); |
336 | BulletSimAPI.SetObjectForce2(Body.Ptr, _force); | 336 | BulletSimAPI.SetObjectForce2(Body.Ptr, _force); |
337 | }); | 337 | }); |
@@ -409,7 +409,7 @@ public sealed class BSPrim : PhysicsActor | |||
409 | _velocity = value; | 409 | _velocity = value; |
410 | _scene.TaintedObject("BSPrim.setVelocity", delegate() | 410 | _scene.TaintedObject("BSPrim.setVelocity", delegate() |
411 | { | 411 | { |
412 | // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity); | 412 | DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity); |
413 | BulletSimAPI.SetObjectVelocity(_scene.WorldID, LocalID, _velocity); | 413 | BulletSimAPI.SetObjectVelocity(_scene.WorldID, LocalID, _velocity); |
414 | }); | 414 | }); |
415 | } | 415 | } |
@@ -417,7 +417,7 @@ public sealed class BSPrim : PhysicsActor | |||
417 | public override OMV.Vector3 Torque { | 417 | public override OMV.Vector3 Torque { |
418 | get { return _torque; } | 418 | get { return _torque; } |
419 | set { _torque = value; | 419 | set { _torque = value; |
420 | // DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque); | 420 | DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque); |
421 | } | 421 | } |
422 | } | 422 | } |
423 | public override float CollisionScore { | 423 | public override float CollisionScore { |
@@ -444,7 +444,7 @@ public sealed class BSPrim : PhysicsActor | |||
444 | _scene.TaintedObject("BSPrim.setOrientation", delegate() | 444 | _scene.TaintedObject("BSPrim.setOrientation", delegate() |
445 | { | 445 | { |
446 | // _position = BulletSimAPI.GetObjectPosition(_scene.WorldID, _localID); | 446 | // _position = BulletSimAPI.GetObjectPosition(_scene.WorldID, _localID); |
447 | // DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 447 | DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
448 | BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); | 448 | BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); |
449 | }); | 449 | }); |
450 | } | 450 | } |
@@ -496,13 +496,15 @@ public sealed class BSPrim : PhysicsActor | |||
496 | _linkset.Refresh(this); | 496 | _linkset.Refresh(this); |
497 | 497 | ||
498 | CollisionFlags cf = BulletSimAPI.GetCollisionFlags2(Body.Ptr); | 498 | CollisionFlags cf = BulletSimAPI.GetCollisionFlags2(Body.Ptr); |
499 | // DetailLog("{0},BSPrim.SetObjectDynamic,taint,static={1},solid={2},mass={3}, cf={4}", LocalID, IsStatic, IsSolid, mass, cf); | 499 | DetailLog("{0},BSPrim.SetObjectDynamic,taint,static={1},solid={2},mass={3}, cf={4}", LocalID, IsStatic, IsSolid, mass, cf); |
500 | } | 500 | } |
501 | 501 | ||
502 | // prims don't fly | 502 | // prims don't fly |
503 | public override bool Flying { | 503 | public override bool Flying { |
504 | get { return _flying; } | 504 | get { return _flying; } |
505 | set { _flying = value; } | 505 | set { |
506 | _flying = value; | ||
507 | } | ||
506 | } | 508 | } |
507 | public override bool SetAlwaysRun { | 509 | public override bool SetAlwaysRun { |
508 | get { return _setAlwaysRun; } | 510 | get { return _setAlwaysRun; } |
@@ -553,7 +555,7 @@ public sealed class BSPrim : PhysicsActor | |||
553 | // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); | 555 | // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); |
554 | _scene.TaintedObject("BSPrim.setRotationalVelocity", delegate() | 556 | _scene.TaintedObject("BSPrim.setRotationalVelocity", delegate() |
555 | { | 557 | { |
556 | // DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); | 558 | DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); |
557 | BulletSimAPI.SetObjectAngularVelocity(_scene.WorldID, LocalID, _rotationalVelocity); | 559 | BulletSimAPI.SetObjectAngularVelocity(_scene.WorldID, LocalID, _rotationalVelocity); |
558 | }); | 560 | }); |
559 | } | 561 | } |
@@ -570,7 +572,7 @@ public sealed class BSPrim : PhysicsActor | |||
570 | _buoyancy = value; | 572 | _buoyancy = value; |
571 | _scene.TaintedObject("BSPrim.setBuoyancy", delegate() | 573 | _scene.TaintedObject("BSPrim.setBuoyancy", delegate() |
572 | { | 574 | { |
573 | // DetailLog("{0},BSPrim.SetBuoyancy,taint,buoy={1}", LocalID, _buoyancy); | 575 | DetailLog("{0},BSPrim.SetBuoyancy,taint,buoy={1}", LocalID, _buoyancy); |
574 | BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, _localID, _buoyancy); | 576 | BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, _localID, _buoyancy); |
575 | }); | 577 | }); |
576 | } | 578 | } |
@@ -633,17 +635,17 @@ public sealed class BSPrim : PhysicsActor | |||
633 | } | 635 | } |
634 | m_accumulatedForces.Clear(); | 636 | m_accumulatedForces.Clear(); |
635 | } | 637 | } |
636 | // DetailLog("{0},BSPrim.AddObjectForce,taint,force={1}", LocalID, _force); | 638 | DetailLog("{0},BSPrim.AddObjectForce,taint,force={1}", LocalID, _force); |
637 | BulletSimAPI.AddObjectForce2(Body.Ptr, fSum); | 639 | BulletSimAPI.AddObjectForce2(Body.Ptr, fSum); |
638 | }); | 640 | }); |
639 | } | 641 | } |
640 | 642 | ||
641 | public override void AddAngularForce(OMV.Vector3 force, bool pushforce) { | 643 | public override void AddAngularForce(OMV.Vector3 force, bool pushforce) { |
642 | // DetailLog("{0},BSPrim.AddAngularForce,call,angForce={1},push={2}", LocalID, force, pushforce); | 644 | DetailLog("{0},BSPrim.AddAngularForce,call,angForce={1},push={2}", LocalID, force, pushforce); |
643 | // m_log.DebugFormat("{0}: AddAngularForce. f={1}, push={2}", LogHeader, force, pushforce); | 645 | // m_log.DebugFormat("{0}: AddAngularForce. f={1}, push={2}", LogHeader, force, pushforce); |
644 | } | 646 | } |
645 | public override void SetMomentum(OMV.Vector3 momentum) { | 647 | public override void SetMomentum(OMV.Vector3 momentum) { |
646 | // DetailLog("{0},BSPrim.SetMomentum,call,mom={1}", LocalID, momentum); | 648 | DetailLog("{0},BSPrim.SetMomentum,call,mom={1}", LocalID, momentum); |
647 | } | 649 | } |
648 | public override void SubscribeEvents(int ms) { | 650 | public override void SubscribeEvents(int ms) { |
649 | _subscribedEventsMs = ms; | 651 | _subscribedEventsMs = ms; |
@@ -987,7 +989,7 @@ public sealed class BSPrim : PhysicsActor | |||
987 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size); | 989 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size); |
988 | if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE)) | 990 | if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE)) |
989 | { | 991 | { |
990 | // DetailLog("{0},BSPrim.CreateGeom,sphere (force={1}", LocalID, forceRebuild); | 992 | DetailLog("{0},BSPrim.CreateGeom,sphere (force={1}", LocalID, forceRebuild); |
991 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE; | 993 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE; |
992 | // Bullet native objects are scaled by the Bullet engine so pass the size in | 994 | // Bullet native objects are scaled by the Bullet engine so pass the size in |
993 | _scale = _size; | 995 | _scale = _size; |
@@ -1001,7 +1003,7 @@ public sealed class BSPrim : PhysicsActor | |||
1001 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, type={2}, size={3}", LogHeader, LocalID, _shapeType, _size); | 1003 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, type={2}, size={3}", LogHeader, LocalID, _shapeType, _size); |
1002 | if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_BOX)) | 1004 | if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_BOX)) |
1003 | { | 1005 | { |
1004 | // DetailLog("{0},BSPrim.CreateGeom,box (force={1})", LocalID, forceRebuild); | 1006 | DetailLog("{0},BSPrim.CreateGeom,box (force={1})", LocalID, forceRebuild); |
1005 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX; | 1007 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX; |
1006 | _scale = _size; | 1008 | _scale = _size; |
1007 | // TODO: do we need to check for and destroy a mesh or hull that might have been left from before? | 1009 | // TODO: do we need to check for and destroy a mesh or hull that might have been left from before? |
@@ -1051,12 +1053,12 @@ public sealed class BSPrim : PhysicsActor | |||
1051 | // if this new shape is the same as last time, don't recreate the mesh | 1053 | // if this new shape is the same as last time, don't recreate the mesh |
1052 | if (_meshKey == newMeshKey) return; | 1054 | if (_meshKey == newMeshKey) return; |
1053 | 1055 | ||
1054 | // DetailLog("{0},BSPrim.CreateGeomMesh,create,key={1}", LocalID, newMeshKey); | 1056 | DetailLog("{0},BSPrim.CreateGeomMesh,create,key={1}", LocalID, newMeshKey); |
1055 | // Since we're recreating new, get rid of any previously generated shape | 1057 | // Since we're recreating new, get rid of any previously generated shape |
1056 | if (_meshKey != 0) | 1058 | if (_meshKey != 0) |
1057 | { | 1059 | { |
1058 | // m_log.DebugFormat("{0}: CreateGeom: deleting old mesh. lID={1}, Key={2}", LogHeader, _localID, _meshKey); | 1060 | // m_log.DebugFormat("{0}: CreateGeom: deleting old mesh. lID={1}, Key={2}", LogHeader, _localID, _meshKey); |
1059 | // DetailLog("{0},BSPrim.CreateGeomMesh,deleteOld,key={1}", LocalID, _meshKey); | 1061 | DetailLog("{0},BSPrim.CreateGeomMesh,deleteOld,key={1}", LocalID, _meshKey); |
1060 | BulletSimAPI.DestroyMesh(_scene.WorldID, _meshKey); | 1062 | BulletSimAPI.DestroyMesh(_scene.WorldID, _meshKey); |
1061 | _mesh = null; | 1063 | _mesh = null; |
1062 | _meshKey = 0; | 1064 | _meshKey = 0; |
@@ -1086,7 +1088,7 @@ public sealed class BSPrim : PhysicsActor | |||
1086 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_MESH; | 1088 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_MESH; |
1087 | // meshes are already scaled by the meshmerizer | 1089 | // meshes are already scaled by the meshmerizer |
1088 | _scale = new OMV.Vector3(1f, 1f, 1f); | 1090 | _scale = new OMV.Vector3(1f, 1f, 1f); |
1089 | // DetailLog("{0},BSPrim.CreateGeomMesh,done", LocalID); | 1091 | DetailLog("{0},BSPrim.CreateGeomMesh,done", LocalID); |
1090 | return; | 1092 | return; |
1091 | } | 1093 | } |
1092 | 1094 | ||
@@ -1100,13 +1102,13 @@ public sealed class BSPrim : PhysicsActor | |||
1100 | // if the hull hasn't changed, don't rebuild it | 1102 | // if the hull hasn't changed, don't rebuild it |
1101 | if (newHullKey == _hullKey) return; | 1103 | if (newHullKey == _hullKey) return; |
1102 | 1104 | ||
1103 | // DetailLog("{0},BSPrim.CreateGeomHull,create,oldKey={1},newKey={2}", LocalID, _hullKey, newHullKey); | 1105 | DetailLog("{0},BSPrim.CreateGeomHull,create,oldKey={1},newKey={2}", LocalID, _hullKey, newHullKey); |
1104 | 1106 | ||
1105 | // Since we're recreating new, get rid of any previously generated shape | 1107 | // Since we're recreating new, get rid of any previously generated shape |
1106 | if (_hullKey != 0) | 1108 | if (_hullKey != 0) |
1107 | { | 1109 | { |
1108 | // m_log.DebugFormat("{0}: CreateGeom: deleting old hull. Key={1}", LogHeader, _hullKey); | 1110 | // m_log.DebugFormat("{0}: CreateGeom: deleting old hull. Key={1}", LogHeader, _hullKey); |
1109 | // DetailLog("{0},BSPrim.CreateGeomHull,deleteOldHull,key={1}", LocalID, _hullKey); | 1111 | DetailLog("{0},BSPrim.CreateGeomHull,deleteOldHull,key={1}", LocalID, _hullKey); |
1110 | BulletSimAPI.DestroyHull(_scene.WorldID, _hullKey); | 1112 | BulletSimAPI.DestroyHull(_scene.WorldID, _hullKey); |
1111 | _hullKey = 0; | 1113 | _hullKey = 0; |
1112 | } | 1114 | } |
@@ -1200,7 +1202,7 @@ public sealed class BSPrim : PhysicsActor | |||
1200 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_HULL; | 1202 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_HULL; |
1201 | // meshes are already scaled by the meshmerizer | 1203 | // meshes are already scaled by the meshmerizer |
1202 | _scale = new OMV.Vector3(1f, 1f, 1f); | 1204 | _scale = new OMV.Vector3(1f, 1f, 1f); |
1203 | // DetailLog("{0},BSPrim.CreateGeomHull,done", LocalID); | 1205 | DetailLog("{0},BSPrim.CreateGeomHull,done", LocalID); |
1204 | return; | 1206 | return; |
1205 | } | 1207 | } |
1206 | 1208 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index d901ff0..56924aa 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -73,6 +73,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
73 | private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 73 | private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
74 | private static readonly string LogHeader = "[BULLETS SCENE]"; | 74 | private static readonly string LogHeader = "[BULLETS SCENE]"; |
75 | 75 | ||
76 | // The name of the region we're working for. | ||
77 | public string RegionName { get; private set; } | ||
78 | |||
76 | public string BulletSimVersion = "?"; | 79 | public string BulletSimVersion = "?"; |
77 | 80 | ||
78 | private Dictionary<uint, BSCharacter> m_avatars = new Dictionary<uint, BSCharacter>(); | 81 | private Dictionary<uint, BSCharacter> m_avatars = new Dictionary<uint, BSCharacter>(); |
@@ -196,6 +199,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
196 | public BSScene(string identifier) | 199 | public BSScene(string identifier) |
197 | { | 200 | { |
198 | m_initialized = false; | 201 | m_initialized = false; |
202 | // we are passed the name of the region we're working for. | ||
203 | RegionName = identifier; | ||
199 | } | 204 | } |
200 | 205 | ||
201 | public override void Initialise(IMesher meshmerizer, IConfigSource config) | 206 | public override void Initialise(IMesher meshmerizer, IConfigSource config) |
@@ -281,10 +286,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
281 | // Very detailed logging for physics debugging | 286 | // Very detailed logging for physics debugging |
282 | m_physicsLoggingEnabled = pConfig.GetBoolean("PhysicsLoggingEnabled", false); | 287 | m_physicsLoggingEnabled = pConfig.GetBoolean("PhysicsLoggingEnabled", false); |
283 | m_physicsLoggingDir = pConfig.GetString("PhysicsLoggingDir", "."); | 288 | m_physicsLoggingDir = pConfig.GetString("PhysicsLoggingDir", "."); |
284 | m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-"); | 289 | m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-%REGIONNAME%-"); |
285 | m_physicsLoggingFileMinutes = pConfig.GetInt("PhysicsLoggingFileMinutes", 5); | 290 | m_physicsLoggingFileMinutes = pConfig.GetInt("PhysicsLoggingFileMinutes", 5); |
286 | // Very detailed logging for vehicle debugging | 291 | // Very detailed logging for vehicle debugging |
287 | m_vehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false); | 292 | m_vehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false); |
293 | |||
294 | // Do any replacements in the parameters | ||
295 | m_physicsLoggingPrefix = m_physicsLoggingPrefix.Replace("%REGIONNAME%", RegionName); | ||
288 | } | 296 | } |
289 | } | 297 | } |
290 | } | 298 | } |
@@ -362,7 +370,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
362 | BSPrim bsprim = prim as BSPrim; | 370 | BSPrim bsprim = prim as BSPrim; |
363 | if (bsprim != null) | 371 | if (bsprim != null) |
364 | { | 372 | { |
365 | // DetailLog("{0},RemovePrim,call", bsprim.LocalID); | 373 | DetailLog("{0},RemovePrim,call", bsprim.LocalID); |
366 | // m_log.DebugFormat("{0}: RemovePrim. id={1}/{2}", LogHeader, bsprim.Name, bsprim.LocalID); | 374 | // m_log.DebugFormat("{0}: RemovePrim. id={1}/{2}", LogHeader, bsprim.Name, bsprim.LocalID); |
367 | try | 375 | try |
368 | { | 376 | { |
@@ -388,7 +396,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
388 | 396 | ||
389 | if (!m_initialized) return null; | 397 | if (!m_initialized) return null; |
390 | 398 | ||
391 | // DetailLog("{0},AddPrimShape,call", localID); | 399 | DetailLog("{0},AddPrimShape,call", localID); |
392 | 400 | ||
393 | BSPrim prim = new BSPrim(localID, primName, this, position, size, rotation, pbs, isPhysical); | 401 | BSPrim prim = new BSPrim(localID, primName, this, position, size, rotation, pbs, isPhysical); |
394 | lock (m_prims) m_prims.Add(localID, prim); | 402 | lock (m_prims) m_prims.Add(localID, prim); |
@@ -534,7 +542,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
534 | else if (m_avatars.ContainsKey(collidingWith)) | 542 | else if (m_avatars.ContainsKey(collidingWith)) |
535 | type = ActorTypes.Agent; | 543 | type = ActorTypes.Agent; |
536 | 544 | ||
537 | DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith); | 545 | // DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith); |
538 | 546 | ||
539 | BSPrim prim; | 547 | BSPrim prim; |
540 | if (m_prims.TryGetValue(localID, out prim)) { | 548 | if (m_prims.TryGetValue(localID, out prim)) { |