diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 86 |
1 files changed, 44 insertions, 42 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 05cc822..9c20004 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -163,13 +163,13 @@ public sealed class BSPrim : PhysicsActor | |||
163 | // m_log.DebugFormat("{0}: Destroy, id={1}", LogHeader, LocalID); | 163 | // m_log.DebugFormat("{0}: Destroy, id={1}", LogHeader, LocalID); |
164 | 164 | ||
165 | // Undo any links between me and any other object | 165 | // Undo any links between me and any other object |
166 | BSPrim parentBefore = _linkset.Root; | 166 | BSPrim parentBefore = _linkset.LinksetRoot; |
167 | int childrenBefore = _linkset.NumberOfChildren; | 167 | int childrenBefore = _linkset.NumberOfChildren; |
168 | 168 | ||
169 | _linkset = _linkset.RemoveMeFromLinkset(this); | 169 | _linkset = _linkset.RemoveMeFromLinkset(this); |
170 | 170 | ||
171 | DetailLog("{0},BSPrim.Destroy,call,parentBefore={1},childrenBefore={2},parentAfter={3},childrenAfter={4}", | 171 | DetailLog("{0},BSPrim.Destroy,call,parentBefore={1},childrenBefore={2},parentAfter={3},childrenAfter={4}", |
172 | LocalID, parentBefore.LocalID, childrenBefore, _linkset.Root.LocalID, _linkset.NumberOfChildren); | 172 | LocalID, parentBefore.LocalID, childrenBefore, _linkset.LinksetRoot.LocalID, _linkset.NumberOfChildren); |
173 | 173 | ||
174 | // Undo any vehicle properties | 174 | // Undo any vehicle properties |
175 | this.VehicleType = (int)Vehicle.TYPE_NONE; | 175 | this.VehicleType = (int)Vehicle.TYPE_NONE; |
@@ -233,13 +233,13 @@ public sealed class BSPrim : PhysicsActor | |||
233 | if (parent != null) | 233 | if (parent != null) |
234 | { | 234 | { |
235 | DebugLog("{0}: link {1}/{2} to {3}", LogHeader, _avName, _localID, parent.LocalID); | 235 | DebugLog("{0}: link {1}/{2} to {3}", LogHeader, _avName, _localID, parent.LocalID); |
236 | BSPrim parentBefore = _linkset.Root; | 236 | BSPrim parentBefore = _linkset.LinksetRoot; |
237 | int childrenBefore = _linkset.NumberOfChildren; | 237 | int childrenBefore = _linkset.NumberOfChildren; |
238 | 238 | ||
239 | _linkset = parent.Linkset.AddMeToLinkset(this); | 239 | _linkset = parent.Linkset.AddMeToLinkset(this); |
240 | 240 | ||
241 | DetailLog("{0},BSPrim.link,call,parentBefore={1}, childrenBefore=={2}, parentAfter={3}, childrenAfter={4}", | 241 | DetailLog("{0},BSPrim.link,call,parentBefore={1}, childrenBefore=={2}, parentAfter={3}, childrenAfter={4}", |
242 | LocalID, parentBefore.LocalID, childrenBefore, _linkset.Root.LocalID, _linkset.NumberOfChildren); | 242 | LocalID, parentBefore.LocalID, childrenBefore, _linkset.LinksetRoot.LocalID, _linkset.NumberOfChildren); |
243 | } | 243 | } |
244 | return; | 244 | return; |
245 | } | 245 | } |
@@ -249,15 +249,15 @@ public sealed class BSPrim : PhysicsActor | |||
249 | // TODO: decide if this parent checking needs to happen at taint time | 249 | // TODO: decide if this parent checking needs to happen at taint time |
250 | // Race condition here: if link() and delink() in same simulation tick, the delink will not happen | 250 | // Race condition here: if link() and delink() in same simulation tick, the delink will not happen |
251 | DebugLog("{0}: delink {1}/{2}. Parent={3}", LogHeader, _avName, _localID, | 251 | DebugLog("{0}: delink {1}/{2}. Parent={3}", LogHeader, _avName, _localID, |
252 | _linkset.Root._avName+"/"+_linkset.Root.LocalID.ToString()); | 252 | _linkset.LinksetRoot._avName+"/"+_linkset.LinksetRoot.LocalID.ToString()); |
253 | 253 | ||
254 | BSPrim parentBefore = _linkset.Root; | 254 | BSPrim parentBefore = _linkset.LinksetRoot; |
255 | int childrenBefore = _linkset.NumberOfChildren; | 255 | int childrenBefore = _linkset.NumberOfChildren; |
256 | 256 | ||
257 | _linkset = _linkset.RemoveMeFromLinkset(this); | 257 | _linkset = _linkset.RemoveMeFromLinkset(this); |
258 | 258 | ||
259 | DetailLog("{0},BSPrim.delink,parentBefore={1},childrenBefore={2},parentAfter={3},childrenAfter={4}, ", | 259 | DetailLog("{0},BSPrim.delink,parentBefore={1},childrenBefore={2},parentAfter={3},childrenAfter={4}, ", |
260 | LocalID, parentBefore.LocalID, childrenBefore, _linkset.Root.LocalID, _linkset.NumberOfChildren); | 260 | LocalID, parentBefore.LocalID, childrenBefore, _linkset.LinksetRoot.LocalID, _linkset.NumberOfChildren); |
261 | return; | 261 | return; |
262 | } | 262 | } |
263 | 263 | ||
@@ -280,7 +280,7 @@ public sealed class BSPrim : PhysicsActor | |||
280 | 280 | ||
281 | public override void LockAngularMotion(OMV.Vector3 axis) | 281 | public override void LockAngularMotion(OMV.Vector3 axis) |
282 | { | 282 | { |
283 | DetailLog("{0},BSPrim.LockAngularMotion,call,axis={1}", LocalID, axis); | 283 | // DetailLog("{0},BSPrim.LockAngularMotion,call,axis={1}", LocalID, axis); |
284 | return; | 284 | return; |
285 | } | 285 | } |
286 | 286 | ||
@@ -299,7 +299,7 @@ public sealed class BSPrim : PhysicsActor | |||
299 | // TODO: what does it mean to set the position of a child prim?? Rebuild the constraint? | 299 | // TODO: what does it mean to set the position of a child prim?? Rebuild the constraint? |
300 | _scene.TaintedObject("BSPrim.setPosition", delegate() | 300 | _scene.TaintedObject("BSPrim.setPosition", delegate() |
301 | { | 301 | { |
302 | DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 302 | // DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
303 | BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); | 303 | BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); |
304 | }); | 304 | }); |
305 | } | 305 | } |
@@ -336,7 +336,7 @@ public sealed class BSPrim : PhysicsActor | |||
336 | _force = value; | 336 | _force = value; |
337 | _scene.TaintedObject("BSPrim.setForce", delegate() | 337 | _scene.TaintedObject("BSPrim.setForce", delegate() |
338 | { | 338 | { |
339 | DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force); | 339 | // DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force); |
340 | // BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force); | 340 | // BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force); |
341 | BulletSimAPI.SetObjectForce2(Body.Ptr, _force); | 341 | BulletSimAPI.SetObjectForce2(Body.Ptr, _force); |
342 | }); | 342 | }); |
@@ -414,7 +414,7 @@ public sealed class BSPrim : PhysicsActor | |||
414 | _velocity = value; | 414 | _velocity = value; |
415 | _scene.TaintedObject("BSPrim.setVelocity", delegate() | 415 | _scene.TaintedObject("BSPrim.setVelocity", delegate() |
416 | { | 416 | { |
417 | DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity); | 417 | // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity); |
418 | BulletSimAPI.SetObjectVelocity(_scene.WorldID, LocalID, _velocity); | 418 | BulletSimAPI.SetObjectVelocity(_scene.WorldID, LocalID, _velocity); |
419 | }); | 419 | }); |
420 | } | 420 | } |
@@ -422,7 +422,7 @@ public sealed class BSPrim : PhysicsActor | |||
422 | public override OMV.Vector3 Torque { | 422 | public override OMV.Vector3 Torque { |
423 | get { return _torque; } | 423 | get { return _torque; } |
424 | set { _torque = value; | 424 | set { _torque = value; |
425 | DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque); | 425 | // DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque); |
426 | } | 426 | } |
427 | } | 427 | } |
428 | public override float CollisionScore { | 428 | public override float CollisionScore { |
@@ -449,7 +449,7 @@ public sealed class BSPrim : PhysicsActor | |||
449 | _scene.TaintedObject("BSPrim.setOrientation", delegate() | 449 | _scene.TaintedObject("BSPrim.setOrientation", delegate() |
450 | { | 450 | { |
451 | // _position = BulletSimAPI.GetObjectPosition(_scene.WorldID, _localID); | 451 | // _position = BulletSimAPI.GetObjectPosition(_scene.WorldID, _localID); |
452 | DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 452 | // DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
453 | BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); | 453 | BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); |
454 | }); | 454 | }); |
455 | } | 455 | } |
@@ -497,8 +497,11 @@ public sealed class BSPrim : PhysicsActor | |||
497 | 497 | ||
498 | BulletSimAPI.SetObjectProperties(_scene.WorldID, LocalID, IsStatic, IsSolid, SubscribedEvents(), mass); | 498 | BulletSimAPI.SetObjectProperties(_scene.WorldID, LocalID, IsStatic, IsSolid, SubscribedEvents(), mass); |
499 | 499 | ||
500 | // recompute any linkset parameters | ||
501 | _linkset.Refresh(this); | ||
502 | |||
500 | CollisionFlags cf = BulletSimAPI.GetCollisionFlags2(Body.Ptr); | 503 | CollisionFlags cf = BulletSimAPI.GetCollisionFlags2(Body.Ptr); |
501 | DetailLog("{0},BSPrim.SetObjectDynamic,taint,static={1},solid={2},mass={3}, cf={4}", LocalID, IsStatic, IsSolid, mass, cf); | 504 | // DetailLog("{0},BSPrim.SetObjectDynamic,taint,static={1},solid={2},mass={3}, cf={4}", LocalID, IsStatic, IsSolid, mass, cf); |
502 | } | 505 | } |
503 | 506 | ||
504 | // prims don't fly | 507 | // prims don't fly |
@@ -555,7 +558,7 @@ public sealed class BSPrim : PhysicsActor | |||
555 | // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); | 558 | // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); |
556 | _scene.TaintedObject("BSPrim.setRotationalVelocity", delegate() | 559 | _scene.TaintedObject("BSPrim.setRotationalVelocity", delegate() |
557 | { | 560 | { |
558 | DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); | 561 | // DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); |
559 | BulletSimAPI.SetObjectAngularVelocity(_scene.WorldID, LocalID, _rotationalVelocity); | 562 | BulletSimAPI.SetObjectAngularVelocity(_scene.WorldID, LocalID, _rotationalVelocity); |
560 | }); | 563 | }); |
561 | } | 564 | } |
@@ -572,7 +575,7 @@ public sealed class BSPrim : PhysicsActor | |||
572 | _buoyancy = value; | 575 | _buoyancy = value; |
573 | _scene.TaintedObject("BSPrim.setBuoyancy", delegate() | 576 | _scene.TaintedObject("BSPrim.setBuoyancy", delegate() |
574 | { | 577 | { |
575 | DetailLog("{0},BSPrim.SetBuoyancy,taint,buoy={1}", LocalID, _buoyancy); | 578 | // DetailLog("{0},BSPrim.SetBuoyancy,taint,buoy={1}", LocalID, _buoyancy); |
576 | BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, _localID, _buoyancy); | 579 | BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, _localID, _buoyancy); |
577 | }); | 580 | }); |
578 | } | 581 | } |
@@ -635,17 +638,17 @@ public sealed class BSPrim : PhysicsActor | |||
635 | } | 638 | } |
636 | m_accumulatedForces.Clear(); | 639 | m_accumulatedForces.Clear(); |
637 | } | 640 | } |
638 | DetailLog("{0},BSPrim.AddObjectForce,taint,force={1}", LocalID, _force); | 641 | // DetailLog("{0},BSPrim.AddObjectForce,taint,force={1}", LocalID, _force); |
639 | BulletSimAPI.AddObjectForce2(Body.Ptr, fSum); | 642 | BulletSimAPI.AddObjectForce2(Body.Ptr, fSum); |
640 | }); | 643 | }); |
641 | } | 644 | } |
642 | 645 | ||
643 | public override void AddAngularForce(OMV.Vector3 force, bool pushforce) { | 646 | public override void AddAngularForce(OMV.Vector3 force, bool pushforce) { |
644 | DetailLog("{0},BSPrim.AddAngularForce,call,angForce={1},push={2}", LocalID, force, pushforce); | 647 | // DetailLog("{0},BSPrim.AddAngularForce,call,angForce={1},push={2}", LocalID, force, pushforce); |
645 | // m_log.DebugFormat("{0}: AddAngularForce. f={1}, push={2}", LogHeader, force, pushforce); | 648 | // m_log.DebugFormat("{0}: AddAngularForce. f={1}, push={2}", LogHeader, force, pushforce); |
646 | } | 649 | } |
647 | public override void SetMomentum(OMV.Vector3 momentum) { | 650 | public override void SetMomentum(OMV.Vector3 momentum) { |
648 | DetailLog("{0},BSPrim.SetMomentum,call,mom={1}", LocalID, momentum); | 651 | // DetailLog("{0},BSPrim.SetMomentum,call,mom={1}", LocalID, momentum); |
649 | } | 652 | } |
650 | public override void SubscribeEvents(int ms) { | 653 | public override void SubscribeEvents(int ms) { |
651 | _subscribedEventsMs = ms; | 654 | _subscribedEventsMs = ms; |
@@ -989,7 +992,7 @@ public sealed class BSPrim : PhysicsActor | |||
989 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size); | 992 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size); |
990 | if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE)) | 993 | if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE)) |
991 | { | 994 | { |
992 | DetailLog("{0},BSPrim.CreateGeom,sphere (force={1}", LocalID, forceRebuild); | 995 | // DetailLog("{0},BSPrim.CreateGeom,sphere (force={1}", LocalID, forceRebuild); |
993 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE; | 996 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE; |
994 | // Bullet native objects are scaled by the Bullet engine so pass the size in | 997 | // Bullet native objects are scaled by the Bullet engine so pass the size in |
995 | _scale = _size; | 998 | _scale = _size; |
@@ -1003,7 +1006,7 @@ public sealed class BSPrim : PhysicsActor | |||
1003 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, type={2}, size={3}", LogHeader, LocalID, _shapeType, _size); | 1006 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, type={2}, size={3}", LogHeader, LocalID, _shapeType, _size); |
1004 | if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_BOX)) | 1007 | if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_BOX)) |
1005 | { | 1008 | { |
1006 | DetailLog("{0},BSPrim.CreateGeom,box (force={1})", LocalID, forceRebuild); | 1009 | // DetailLog("{0},BSPrim.CreateGeom,box (force={1})", LocalID, forceRebuild); |
1007 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX; | 1010 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX; |
1008 | _scale = _size; | 1011 | _scale = _size; |
1009 | // TODO: do we need to check for and destroy a mesh or hull that might have been left from before? | 1012 | // TODO: do we need to check for and destroy a mesh or hull that might have been left from before? |
@@ -1046,12 +1049,12 @@ public sealed class BSPrim : PhysicsActor | |||
1046 | // if this new shape is the same as last time, don't recreate the mesh | 1049 | // if this new shape is the same as last time, don't recreate the mesh |
1047 | if (_meshKey == newMeshKey) return; | 1050 | if (_meshKey == newMeshKey) return; |
1048 | 1051 | ||
1049 | DetailLog("{0},BSPrim.CreateGeomMesh,create,key={1}", LocalID, newMeshKey); | 1052 | // DetailLog("{0},BSPrim.CreateGeomMesh,create,key={1}", LocalID, newMeshKey); |
1050 | // Since we're recreating new, get rid of any previously generated shape | 1053 | // Since we're recreating new, get rid of any previously generated shape |
1051 | if (_meshKey != 0) | 1054 | if (_meshKey != 0) |
1052 | { | 1055 | { |
1053 | // m_log.DebugFormat("{0}: CreateGeom: deleting old mesh. lID={1}, Key={2}", LogHeader, _localID, _meshKey); | 1056 | // m_log.DebugFormat("{0}: CreateGeom: deleting old mesh. lID={1}, Key={2}", LogHeader, _localID, _meshKey); |
1054 | DetailLog("{0},BSPrim.CreateGeomMesh,deleteOld,key={1}", LocalID, _meshKey); | 1057 | // DetailLog("{0},BSPrim.CreateGeomMesh,deleteOld,key={1}", LocalID, _meshKey); |
1055 | BulletSimAPI.DestroyMesh(_scene.WorldID, _meshKey); | 1058 | BulletSimAPI.DestroyMesh(_scene.WorldID, _meshKey); |
1056 | _mesh = null; | 1059 | _mesh = null; |
1057 | _meshKey = 0; | 1060 | _meshKey = 0; |
@@ -1081,7 +1084,7 @@ public sealed class BSPrim : PhysicsActor | |||
1081 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_MESH; | 1084 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_MESH; |
1082 | // meshes are already scaled by the meshmerizer | 1085 | // meshes are already scaled by the meshmerizer |
1083 | _scale = new OMV.Vector3(1f, 1f, 1f); | 1086 | _scale = new OMV.Vector3(1f, 1f, 1f); |
1084 | DetailLog("{0},BSPrim.CreateGeomMesh,done", LocalID); | 1087 | // DetailLog("{0},BSPrim.CreateGeomMesh,done", LocalID); |
1085 | return; | 1088 | return; |
1086 | } | 1089 | } |
1087 | 1090 | ||
@@ -1095,28 +1098,21 @@ public sealed class BSPrim : PhysicsActor | |||
1095 | // if the hull hasn't changed, don't rebuild it | 1098 | // if the hull hasn't changed, don't rebuild it |
1096 | if (newHullKey == _hullKey) return; | 1099 | if (newHullKey == _hullKey) return; |
1097 | 1100 | ||
1098 | DetailLog("{0},BSPrim.CreateGeomHull,create,key={1}", LocalID, _meshKey); | 1101 | // DetailLog("{0},BSPrim.CreateGeomHull,create,oldKey={1},newKey={2}", LocalID, _hullKey, newHullKey); |
1099 | 1102 | ||
1100 | // Since we're recreating new, get rid of any previously generated shape | 1103 | // Since we're recreating new, get rid of any previously generated shape |
1101 | if (_hullKey != 0) | 1104 | if (_hullKey != 0) |
1102 | { | 1105 | { |
1103 | // m_log.DebugFormat("{0}: CreateGeom: deleting old hull. Key={1}", LogHeader, _hullKey); | 1106 | // m_log.DebugFormat("{0}: CreateGeom: deleting old hull. Key={1}", LogHeader, _hullKey); |
1104 | DetailLog("{0},BSPrim.CreateGeomHull,deleteOldHull,key={1}", LocalID, _meshKey); | 1107 | // DetailLog("{0},BSPrim.CreateGeomHull,deleteOldHull,key={1}", LocalID, _hullKey); |
1105 | BulletSimAPI.DestroyHull(_scene.WorldID, _hullKey); | 1108 | BulletSimAPI.DestroyHull(_scene.WorldID, _hullKey); |
1106 | _hullKey = 0; | 1109 | _hullKey = 0; |
1107 | _hulls.Clear(); | ||
1108 | DetailLog("{0},BSPrim.CreateGeomHull,deleteOldMesh,key={1}", LocalID, _meshKey); | ||
1109 | BulletSimAPI.DestroyMesh(_scene.WorldID, _meshKey); | ||
1110 | _mesh = null; // the mesh cannot match either | ||
1111 | _meshKey = 0; | ||
1112 | } | 1110 | } |
1113 | 1111 | ||
1114 | _hullKey = newHullKey; | 1112 | _hullKey = newHullKey; |
1115 | if (_meshKey != _hullKey) | 1113 | |
1116 | { | 1114 | // Make sure the underlying mesh exists and is correct |
1117 | // if the underlying mesh has changed, rebuild it | 1115 | CreateGeomMesh(); |
1118 | CreateGeomMesh(); | ||
1119 | } | ||
1120 | 1116 | ||
1121 | int[] indices = _mesh.getIndexListAsInt(); | 1117 | int[] indices = _mesh.getIndexListAsInt(); |
1122 | List<OMV.Vector3> vertices = _mesh.getVertexList(); | 1118 | List<OMV.Vector3> vertices = _mesh.getVertexList(); |
@@ -1142,7 +1138,7 @@ public sealed class BSPrim : PhysicsActor | |||
1142 | // create the hull into the _hulls variable | 1138 | // create the hull into the _hulls variable |
1143 | convexBuilder.process(dcomp); | 1139 | convexBuilder.process(dcomp); |
1144 | 1140 | ||
1145 | // Convert the vertices and indices for passing to unmanaged | 1141 | // Convert the vertices and indices for passing to unmanaged. |
1146 | // The hull information is passed as a large floating point array. | 1142 | // The hull information is passed as a large floating point array. |
1147 | // The format is: | 1143 | // The format is: |
1148 | // convHulls[0] = number of hulls | 1144 | // convHulls[0] = number of hulls |
@@ -1202,7 +1198,7 @@ public sealed class BSPrim : PhysicsActor | |||
1202 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_HULL; | 1198 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_HULL; |
1203 | // meshes are already scaled by the meshmerizer | 1199 | // meshes are already scaled by the meshmerizer |
1204 | _scale = new OMV.Vector3(1f, 1f, 1f); | 1200 | _scale = new OMV.Vector3(1f, 1f, 1f); |
1205 | DetailLog("{0},BSPrim.CreateGeomHull,done", LocalID); | 1201 | // DetailLog("{0},BSPrim.CreateGeomHull,done", LocalID); |
1206 | return; | 1202 | return; |
1207 | } | 1203 | } |
1208 | 1204 | ||
@@ -1340,11 +1336,12 @@ public sealed class BSPrim : PhysicsActor | |||
1340 | 1336 | ||
1341 | // 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}", |
1342 | // LogHeader, LocalID, changed, _position, _orientation, _velocity, _acceleration, _rotationalVelocity); | 1338 | // LogHeader, LocalID, changed, _position, _orientation, _velocity, _acceleration, _rotationalVelocity); |
1343 | DetailLog("{0},BSPrim.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}", |
1344 | LocalID, _position, _orientation, _velocity, _acceleration, _rotationalVelocity); | 1340 | // LocalID, _position, _orientation, _velocity, _acceleration, _rotationalVelocity); |
1345 | 1341 | ||
1346 | base.RequestPhysicsterseUpdate(); | 1342 | base.RequestPhysicsterseUpdate(); |
1347 | } | 1343 | } |
1344 | /* | ||
1348 | else | 1345 | else |
1349 | { | 1346 | { |
1350 | // For debugging, we also report the movement of children | 1347 | // For debugging, we also report the movement of children |
@@ -1352,10 +1349,11 @@ public sealed class BSPrim : PhysicsActor | |||
1352 | LocalID, entprop.Position, entprop.Rotation, entprop.Velocity, | 1349 | LocalID, entprop.Position, entprop.Rotation, entprop.Velocity, |
1353 | entprop.Acceleration, entprop.RotationalVelocity); | 1350 | entprop.Acceleration, entprop.RotationalVelocity); |
1354 | } | 1351 | } |
1352 | */ | ||
1355 | } | 1353 | } |
1356 | 1354 | ||
1357 | // I've collided with something | 1355 | // I've collided with something |
1358 | CollisionEventUpdate collisionCollection = null; | 1356 | CollisionEventUpdate collisionCollection; |
1359 | public void Collide(uint collidingWith, ActorTypes type, OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth) | 1357 | public void Collide(uint collidingWith, ActorTypes type, OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth) |
1360 | { | 1358 | { |
1361 | // m_log.DebugFormat("{0}: Collide: ms={1}, id={2}, with={3}", LogHeader, _subscribedEventsMs, LocalID, collidingWith); | 1359 | // m_log.DebugFormat("{0}: Collide: ms={1}, id={2}, with={3}", LogHeader, _subscribedEventsMs, LocalID, collidingWith); |
@@ -1367,6 +1365,8 @@ public sealed class BSPrim : PhysicsActor | |||
1367 | _collidingGroundStep = _scene.SimulationStep; | 1365 | _collidingGroundStep = _scene.SimulationStep; |
1368 | } | 1366 | } |
1369 | 1367 | ||
1368 | // DetailLog("{0},BSPrim.Collison,call,with={1}", LocalID, collidingWith); | ||
1369 | |||
1370 | // if someone is subscribed to collision events.... | 1370 | // if someone is subscribed to collision events.... |
1371 | if (_subscribedEventsMs != 0) { | 1371 | if (_subscribedEventsMs != 0) { |
1372 | // throttle the collisions to the number of milliseconds specified in the subscription | 1372 | // throttle the collisions to the number of milliseconds specified in the subscription |
@@ -1387,7 +1387,9 @@ public sealed class BSPrim : PhysicsActor | |||
1387 | if (collisionCollection != null && collisionCollection.Count > 0) | 1387 | if (collisionCollection != null && collisionCollection.Count > 0) |
1388 | { | 1388 | { |
1389 | base.SendCollisionUpdate(collisionCollection); | 1389 | base.SendCollisionUpdate(collisionCollection); |
1390 | collisionCollection.Clear(); | 1390 | // The collisionCollection structure is passed around in the simulator. |
1391 | // Make sure we don't have a handle to that one and that a new one is used next time. | ||
1392 | collisionCollection = null; | ||
1391 | } | 1393 | } |
1392 | } | 1394 | } |
1393 | 1395 | ||