diff options
author | Robert Adams | 2012-08-24 12:58:42 -0700 |
---|---|---|
committer | Robert Adams | 2012-08-31 11:41:12 -0700 |
commit | 7b6987ce83d16871f6070f3cc7d56280ad3d5dbe (patch) | |
tree | d996f2e9871d0d8bba505d9f581c7f42a8f040b3 /OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |
parent | BulletSim: add new interface for mesh, hull and terrain creation that will mo... (diff) | |
download | opensim-SC-7b6987ce83d16871f6070f3cc7d56280ad3d5dbe.zip opensim-SC-7b6987ce83d16871f6070f3cc7d56280ad3d5dbe.tar.gz opensim-SC-7b6987ce83d16871f6070f3cc7d56280ad3d5dbe.tar.bz2 opensim-SC-7b6987ce83d16871f6070f3cc7d56280ad3d5dbe.tar.xz |
BulletSim: unify physical objects under BSPhysObjects. Now BSScene and BSLinkset only know of BSPhysObject's and there is only one list to search in BSScene.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 137 |
1 files changed, 61 insertions, 76 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 56924aa..ce64b9b 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -78,14 +78,12 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
78 | 78 | ||
79 | public string BulletSimVersion = "?"; | 79 | public string BulletSimVersion = "?"; |
80 | 80 | ||
81 | private Dictionary<uint, BSCharacter> m_avatars = new Dictionary<uint, BSCharacter>(); | 81 | public Dictionary<uint, BSPhysObject> PhysObjects = new Dictionary<uint, BSPhysObject>(); |
82 | public Dictionary<uint, BSCharacter> Characters { get { return m_avatars; } } | ||
83 | |||
84 | private Dictionary<uint, BSPrim> m_prims = new Dictionary<uint, BSPrim>(); | ||
85 | public Dictionary<uint, BSPrim> Prims { get { return m_prims; } } | ||
86 | 82 | ||
83 | private HashSet<BSPhysObject> m_objectsWithCollisions = new HashSet<BSPhysObject>(); | ||
84 | // Following is a kludge and can be removed when avatar animation updating is | ||
85 | // moved to a better place. | ||
87 | private HashSet<BSCharacter> m_avatarsWithCollisions = new HashSet<BSCharacter>(); | 86 | private HashSet<BSCharacter> m_avatarsWithCollisions = new HashSet<BSCharacter>(); |
88 | private HashSet<BSPrim> m_primsWithCollisions = new HashSet<BSPrim>(); | ||
89 | 87 | ||
90 | private List<BSPrim> m_vehicles = new List<BSPrim>(); | 88 | private List<BSPrim> m_vehicles = new List<BSPrim>(); |
91 | 89 | ||
@@ -235,7 +233,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
235 | // BulletSimVersion = BulletSimAPI.GetVersion(); | 233 | // BulletSimVersion = BulletSimAPI.GetVersion(); |
236 | // m_log.WarnFormat("{0}: BulletSim.dll version='{1}'", LogHeader, BulletSimVersion); | 234 | // m_log.WarnFormat("{0}: BulletSim.dll version='{1}'", LogHeader, BulletSimVersion); |
237 | 235 | ||
238 | // if Debug, enable logging from the unmanaged code | 236 | // If Debug logging level, enable logging from the unmanaged code |
239 | if (m_log.IsDebugEnabled || PhysicsLogging.Enabled) | 237 | if (m_log.IsDebugEnabled || PhysicsLogging.Enabled) |
240 | { | 238 | { |
241 | m_log.DebugFormat("{0}: Initialize: Setting debug callback for unmanaged code", LogHeader); | 239 | m_log.DebugFormat("{0}: Initialize: Setting debug callback for unmanaged code", LogHeader); |
@@ -243,13 +241,14 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
243 | m_DebugLogCallbackHandle = new BulletSimAPI.DebugLogCallback(BulletLoggerPhysLog); | 241 | m_DebugLogCallbackHandle = new BulletSimAPI.DebugLogCallback(BulletLoggerPhysLog); |
244 | else | 242 | else |
245 | m_DebugLogCallbackHandle = new BulletSimAPI.DebugLogCallback(BulletLogger); | 243 | m_DebugLogCallbackHandle = new BulletSimAPI.DebugLogCallback(BulletLogger); |
246 | // the handle is saved in a variable to make sure it doesn't get freed after this call | 244 | // The handle is saved in a variable to make sure it doesn't get freed after this call |
247 | BulletSimAPI.SetDebugLogCallback(m_DebugLogCallbackHandle); | 245 | BulletSimAPI.SetDebugLogCallback(m_DebugLogCallbackHandle); |
248 | } | 246 | } |
249 | 247 | ||
250 | _taintedObjects = new List<TaintCallbackEntry>(); | 248 | _taintedObjects = new List<TaintCallbackEntry>(); |
251 | 249 | ||
252 | mesher = meshmerizer; | 250 | mesher = meshmerizer; |
251 | |||
253 | // The bounding box for the simulated world | 252 | // The bounding box for the simulated world |
254 | Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, 8192f); | 253 | Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, 8192f); |
255 | 254 | ||
@@ -337,7 +336,11 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
337 | if (!m_initialized) return null; | 336 | if (!m_initialized) return null; |
338 | 337 | ||
339 | BSCharacter actor = new BSCharacter(localID, avName, this, position, size, isFlying); | 338 | BSCharacter actor = new BSCharacter(localID, avName, this, position, size, isFlying); |
340 | lock (m_avatars) m_avatars.Add(localID, actor); | 339 | lock (PhysObjects) PhysObjects.Add(localID, actor); |
340 | |||
341 | // Remove kludge someday | ||
342 | lock (m_avatarsWithCollisions) m_avatarsWithCollisions.Add(actor); | ||
343 | |||
341 | return actor; | 344 | return actor; |
342 | } | 345 | } |
343 | 346 | ||
@@ -352,7 +355,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
352 | { | 355 | { |
353 | try | 356 | try |
354 | { | 357 | { |
355 | lock (m_avatars) m_avatars.Remove(actor.LocalID); | 358 | lock (PhysObjects) PhysObjects.Remove(actor.LocalID); |
359 | // Remove kludge someday | ||
360 | lock (m_avatarsWithCollisions) m_avatarsWithCollisions.Remove(bsactor); | ||
356 | } | 361 | } |
357 | catch (Exception e) | 362 | catch (Exception e) |
358 | { | 363 | { |
@@ -374,7 +379,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
374 | // m_log.DebugFormat("{0}: RemovePrim. id={1}/{2}", LogHeader, bsprim.Name, bsprim.LocalID); | 379 | // m_log.DebugFormat("{0}: RemovePrim. id={1}/{2}", LogHeader, bsprim.Name, bsprim.LocalID); |
375 | try | 380 | try |
376 | { | 381 | { |
377 | lock (m_prims) m_prims.Remove(bsprim.LocalID); | 382 | lock (PhysObjects) PhysObjects.Remove(bsprim.LocalID); |
378 | } | 383 | } |
379 | catch (Exception e) | 384 | catch (Exception e) |
380 | { | 385 | { |
@@ -399,7 +404,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
399 | DetailLog("{0},AddPrimShape,call", localID); | 404 | DetailLog("{0},AddPrimShape,call", localID); |
400 | 405 | ||
401 | BSPrim prim = new BSPrim(localID, primName, this, position, size, rotation, pbs, isPhysical); | 406 | BSPrim prim = new BSPrim(localID, primName, this, position, size, rotation, pbs, isPhysical); |
402 | lock (m_prims) m_prims.Add(localID, prim); | 407 | lock (PhysObjects) PhysObjects.Add(localID, prim); |
403 | return prim; | 408 | return prim; |
404 | } | 409 | } |
405 | 410 | ||
@@ -470,19 +475,16 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
470 | 475 | ||
471 | // The above SendCollision's batch up the collisions on the objects. | 476 | // The above SendCollision's batch up the collisions on the objects. |
472 | // Now push the collisions into the simulator. | 477 | // Now push the collisions into the simulator. |
473 | foreach (BSPrim bsp in m_primsWithCollisions) | 478 | foreach (BSPhysObject bsp in m_objectsWithCollisions) |
474 | bsp.SendCollisions(); | 479 | bsp.SendCollisions(); |
475 | m_primsWithCollisions.Clear(); | 480 | m_objectsWithCollisions.Clear(); |
476 | 481 | ||
477 | // This is a kludge to get avatar movement updated. | 482 | // This is a kludge to get avatar movement updated. |
478 | // Don't send collisions only if there were collisions -- send everytime. | ||
479 | // ODE sends collisions even if there are none and this is used to update | 483 | // ODE sends collisions even if there are none and this is used to update |
480 | // avatar animations and stuff. | 484 | // avatar animations and stuff. |
481 | // foreach (BSCharacter bsc in m_avatarsWithCollisions) | 485 | foreach (BSPhysObject bpo in m_avatarsWithCollisions) |
482 | // bsc.SendCollisions(); | 486 | bpo.SendCollisions(); |
483 | foreach (KeyValuePair<uint, BSCharacter> kvp in m_avatars) | 487 | // m_avatarsWithCollisions.Clear(); |
484 | kvp.Value.SendCollisions(); | ||
485 | m_avatarsWithCollisions.Clear(); | ||
486 | 488 | ||
487 | // If any of the objects had updated properties, tell the object it has been changed by the physics engine | 489 | // If any of the objects had updated properties, tell the object it has been changed by the physics engine |
488 | if (updatedEntityCount > 0) | 490 | if (updatedEntityCount > 0) |
@@ -490,16 +492,10 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
490 | for (int ii = 0; ii < updatedEntityCount; ii++) | 492 | for (int ii = 0; ii < updatedEntityCount; ii++) |
491 | { | 493 | { |
492 | EntityProperties entprop = m_updateArray[ii]; | 494 | EntityProperties entprop = m_updateArray[ii]; |
493 | BSPrim prim; | 495 | BSPhysObject pobj; |
494 | if (m_prims.TryGetValue(entprop.ID, out prim)) | 496 | if (PhysObjects.TryGetValue(entprop.ID, out pobj)) |
495 | { | ||
496 | prim.UpdateProperties(entprop); | ||
497 | continue; | ||
498 | } | ||
499 | BSCharacter actor; | ||
500 | if (m_avatars.TryGetValue(entprop.ID, out actor)) | ||
501 | { | 497 | { |
502 | actor.UpdateProperties(entprop); | 498 | pobj.UpdateProperties(entprop); |
503 | continue; | 499 | continue; |
504 | } | 500 | } |
505 | } | 501 | } |
@@ -529,33 +525,36 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
529 | } | 525 | } |
530 | 526 | ||
531 | // Something has collided | 527 | // Something has collided |
532 | private void SendCollision(uint localID, uint collidingWith, Vector3 collidePoint, Vector3 collideNormal, float penitration) | 528 | private void SendCollision(uint localID, uint collidingWith, Vector3 collidePoint, Vector3 collideNormal, float penetration) |
533 | { | 529 | { |
534 | if (localID == TERRAIN_ID || localID == GROUNDPLANE_ID) | 530 | if (localID == TERRAIN_ID || localID == GROUNDPLANE_ID) |
535 | { | 531 | { |
536 | return; // don't send collisions to the terrain | 532 | return; // don't send collisions to the terrain |
537 | } | 533 | } |
538 | 534 | ||
535 | BSPhysObject collider = PhysObjects[localID]; | ||
536 | // TODO: as of this code, terrain was not in the physical object list. | ||
537 | // When BSTerrain is created and it will be in the list, we can remove | ||
538 | // the possibility that it's not there and just fetch the collidee. | ||
539 | BSPhysObject collidee = null; | ||
540 | |||
539 | ActorTypes type = ActorTypes.Prim; | 541 | ActorTypes type = ActorTypes.Prim; |
540 | if (collidingWith == TERRAIN_ID || collidingWith == GROUNDPLANE_ID) | 542 | if (collidingWith == TERRAIN_ID || collidingWith == GROUNDPLANE_ID) |
543 | { | ||
541 | type = ActorTypes.Ground; | 544 | type = ActorTypes.Ground; |
542 | else if (m_avatars.ContainsKey(collidingWith)) | 545 | } |
543 | type = ActorTypes.Agent; | 546 | else |
547 | { | ||
548 | collidee = PhysObjects[collidingWith]; | ||
549 | if (collidee is BSCharacter) | ||
550 | type = ActorTypes.Agent; | ||
551 | } | ||
544 | 552 | ||
545 | // DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith); | 553 | // DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith); |
546 | 554 | ||
547 | BSPrim prim; | 555 | collider.Collide(collidingWith, collidee, type, collidePoint, collideNormal, penetration); |
548 | if (m_prims.TryGetValue(localID, out prim)) { | 556 | m_objectsWithCollisions.Add(collider); |
549 | prim.Collide(collidingWith, type, collidePoint, collideNormal, penitration); | 557 | |
550 | m_primsWithCollisions.Add(prim); | ||
551 | return; | ||
552 | } | ||
553 | BSCharacter actor; | ||
554 | if (m_avatars.TryGetValue(localID, out actor)) { | ||
555 | actor.Collide(collidingWith, type, collidePoint, collideNormal, penitration); | ||
556 | m_avatarsWithCollisions.Add(actor); | ||
557 | return; | ||
558 | } | ||
559 | return; | 558 | return; |
560 | } | 559 | } |
561 | 560 | ||
@@ -605,17 +604,11 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
605 | // make sure no stepping happens while we're deleting stuff | 604 | // make sure no stepping happens while we're deleting stuff |
606 | m_initialized = false; | 605 | m_initialized = false; |
607 | 606 | ||
608 | foreach (KeyValuePair<uint, BSCharacter> kvp in m_avatars) | 607 | foreach (KeyValuePair<uint, BSPhysObject> kvp in PhysObjects) |
609 | { | ||
610 | kvp.Value.Destroy(); | ||
611 | } | ||
612 | m_avatars.Clear(); | ||
613 | |||
614 | foreach (KeyValuePair<uint, BSPrim> kvp in m_prims) | ||
615 | { | 608 | { |
616 | kvp.Value.Destroy(); | 609 | kvp.Value.Destroy(); |
617 | } | 610 | } |
618 | m_prims.Clear(); | 611 | PhysObjects.Clear(); |
619 | 612 | ||
620 | // Now that the prims are all cleaned up, there should be no constraints left | 613 | // Now that the prims are all cleaned up, there should be no constraints left |
621 | if (m_constraintCollection != null) | 614 | if (m_constraintCollection != null) |
@@ -996,42 +989,42 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
996 | 0f, | 989 | 0f, |
997 | (s,cf,p,v) => { s.m_params[0].linearDamping = cf.GetFloat(p, v); }, | 990 | (s,cf,p,v) => { s.m_params[0].linearDamping = cf.GetFloat(p, v); }, |
998 | (s) => { return s.m_params[0].linearDamping; }, | 991 | (s) => { return s.m_params[0].linearDamping; }, |
999 | (s,p,l,v) => { s.UpdateParameterPrims(ref s.m_params[0].linearDamping, p, l, v); } ), | 992 | (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].linearDamping, p, l, v); } ), |
1000 | new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", | 993 | new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", |
1001 | 0f, | 994 | 0f, |
1002 | (s,cf,p,v) => { s.m_params[0].angularDamping = cf.GetFloat(p, v); }, | 995 | (s,cf,p,v) => { s.m_params[0].angularDamping = cf.GetFloat(p, v); }, |
1003 | (s) => { return s.m_params[0].angularDamping; }, | 996 | (s) => { return s.m_params[0].angularDamping; }, |
1004 | (s,p,l,v) => { s.UpdateParameterPrims(ref s.m_params[0].angularDamping, p, l, v); } ), | 997 | (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].angularDamping, p, l, v); } ), |
1005 | new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static", | 998 | new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static", |
1006 | 0.2f, | 999 | 0.2f, |
1007 | (s,cf,p,v) => { s.m_params[0].deactivationTime = cf.GetFloat(p, v); }, | 1000 | (s,cf,p,v) => { s.m_params[0].deactivationTime = cf.GetFloat(p, v); }, |
1008 | (s) => { return s.m_params[0].deactivationTime; }, | 1001 | (s) => { return s.m_params[0].deactivationTime; }, |
1009 | (s,p,l,v) => { s.UpdateParameterPrims(ref s.m_params[0].deactivationTime, p, l, v); } ), | 1002 | (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].deactivationTime, p, l, v); } ), |
1010 | new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", | 1003 | new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", |
1011 | 0.8f, | 1004 | 0.8f, |
1012 | (s,cf,p,v) => { s.m_params[0].linearSleepingThreshold = cf.GetFloat(p, v); }, | 1005 | (s,cf,p,v) => { s.m_params[0].linearSleepingThreshold = cf.GetFloat(p, v); }, |
1013 | (s) => { return s.m_params[0].linearSleepingThreshold; }, | 1006 | (s) => { return s.m_params[0].linearSleepingThreshold; }, |
1014 | (s,p,l,v) => { s.UpdateParameterPrims(ref s.m_params[0].linearSleepingThreshold, p, l, v); } ), | 1007 | (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].linearSleepingThreshold, p, l, v); } ), |
1015 | new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", | 1008 | new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", |
1016 | 1.0f, | 1009 | 1.0f, |
1017 | (s,cf,p,v) => { s.m_params[0].angularSleepingThreshold = cf.GetFloat(p, v); }, | 1010 | (s,cf,p,v) => { s.m_params[0].angularSleepingThreshold = cf.GetFloat(p, v); }, |
1018 | (s) => { return s.m_params[0].angularSleepingThreshold; }, | 1011 | (s) => { return s.m_params[0].angularSleepingThreshold; }, |
1019 | (s,p,l,v) => { s.UpdateParameterPrims(ref s.m_params[0].angularSleepingThreshold, p, l, v); } ), | 1012 | (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].angularSleepingThreshold, p, l, v); } ), |
1020 | new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , | 1013 | new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , |
1021 | 0f, // set to zero to disable | 1014 | 0f, // set to zero to disable |
1022 | (s,cf,p,v) => { s.m_params[0].ccdMotionThreshold = cf.GetFloat(p, v); }, | 1015 | (s,cf,p,v) => { s.m_params[0].ccdMotionThreshold = cf.GetFloat(p, v); }, |
1023 | (s) => { return s.m_params[0].ccdMotionThreshold; }, | 1016 | (s) => { return s.m_params[0].ccdMotionThreshold; }, |
1024 | (s,p,l,v) => { s.UpdateParameterPrims(ref s.m_params[0].ccdMotionThreshold, p, l, v); } ), | 1017 | (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].ccdMotionThreshold, p, l, v); } ), |
1025 | new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , | 1018 | new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , |
1026 | 0f, | 1019 | 0f, |
1027 | (s,cf,p,v) => { s.m_params[0].ccdSweptSphereRadius = cf.GetFloat(p, v); }, | 1020 | (s,cf,p,v) => { s.m_params[0].ccdSweptSphereRadius = cf.GetFloat(p, v); }, |
1028 | (s) => { return s.m_params[0].ccdSweptSphereRadius; }, | 1021 | (s) => { return s.m_params[0].ccdSweptSphereRadius; }, |
1029 | (s,p,l,v) => { s.UpdateParameterPrims(ref s.m_params[0].ccdSweptSphereRadius, p, l, v); } ), | 1022 | (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].ccdSweptSphereRadius, p, l, v); } ), |
1030 | new ParameterDefn("ContactProcessingThreshold", "Distance between contacts before doing collision check" , | 1023 | new ParameterDefn("ContactProcessingThreshold", "Distance between contacts before doing collision check" , |
1031 | 0.1f, | 1024 | 0.1f, |
1032 | (s,cf,p,v) => { s.m_params[0].contactProcessingThreshold = cf.GetFloat(p, v); }, | 1025 | (s,cf,p,v) => { s.m_params[0].contactProcessingThreshold = cf.GetFloat(p, v); }, |
1033 | (s) => { return s.m_params[0].contactProcessingThreshold; }, | 1026 | (s) => { return s.m_params[0].contactProcessingThreshold; }, |
1034 | (s,p,l,v) => { s.UpdateParameterPrims(ref s.m_params[0].contactProcessingThreshold, p, l, v); } ), | 1027 | (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].contactProcessingThreshold, p, l, v); } ), |
1035 | 1028 | ||
1036 | new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , | 1029 | new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , |
1037 | 0.5f, | 1030 | 0.5f, |
@@ -1052,32 +1045,32 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
1052 | 0.5f, | 1045 | 0.5f, |
1053 | (s,cf,p,v) => { s.m_params[0].avatarFriction = cf.GetFloat(p, v); }, | 1046 | (s,cf,p,v) => { s.m_params[0].avatarFriction = cf.GetFloat(p, v); }, |
1054 | (s) => { return s.m_params[0].avatarFriction; }, | 1047 | (s) => { return s.m_params[0].avatarFriction; }, |
1055 | (s,p,l,v) => { s.UpdateParameterAvatars(ref s.m_params[0].avatarFriction, p, l, v); } ), | 1048 | (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].avatarFriction, p, l, v); } ), |
1056 | new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", | 1049 | new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", |
1057 | 60f, | 1050 | 60f, |
1058 | (s,cf,p,v) => { s.m_params[0].avatarDensity = cf.GetFloat(p, v); }, | 1051 | (s,cf,p,v) => { s.m_params[0].avatarDensity = cf.GetFloat(p, v); }, |
1059 | (s) => { return s.m_params[0].avatarDensity; }, | 1052 | (s) => { return s.m_params[0].avatarDensity; }, |
1060 | (s,p,l,v) => { s.UpdateParameterAvatars(ref s.m_params[0].avatarDensity, p, l, v); } ), | 1053 | (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].avatarDensity, p, l, v); } ), |
1061 | new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", | 1054 | new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", |
1062 | 0f, | 1055 | 0f, |
1063 | (s,cf,p,v) => { s.m_params[0].avatarRestitution = cf.GetFloat(p, v); }, | 1056 | (s,cf,p,v) => { s.m_params[0].avatarRestitution = cf.GetFloat(p, v); }, |
1064 | (s) => { return s.m_params[0].avatarRestitution; }, | 1057 | (s) => { return s.m_params[0].avatarRestitution; }, |
1065 | (s,p,l,v) => { s.UpdateParameterAvatars(ref s.m_params[0].avatarRestitution, p, l, v); } ), | 1058 | (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].avatarRestitution, p, l, v); } ), |
1066 | new ParameterDefn("AvatarCapsuleRadius", "Radius of space around an avatar", | 1059 | new ParameterDefn("AvatarCapsuleRadius", "Radius of space around an avatar", |
1067 | 0.37f, | 1060 | 0.37f, |
1068 | (s,cf,p,v) => { s.m_params[0].avatarCapsuleRadius = cf.GetFloat(p, v); }, | 1061 | (s,cf,p,v) => { s.m_params[0].avatarCapsuleRadius = cf.GetFloat(p, v); }, |
1069 | (s) => { return s.m_params[0].avatarCapsuleRadius; }, | 1062 | (s) => { return s.m_params[0].avatarCapsuleRadius; }, |
1070 | (s,p,l,v) => { s.UpdateParameterAvatars(ref s.m_params[0].avatarCapsuleRadius, p, l, v); } ), | 1063 | (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].avatarCapsuleRadius, p, l, v); } ), |
1071 | new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", | 1064 | new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", |
1072 | 1.5f, | 1065 | 1.5f, |
1073 | (s,cf,p,v) => { s.m_params[0].avatarCapsuleHeight = cf.GetFloat(p, v); }, | 1066 | (s,cf,p,v) => { s.m_params[0].avatarCapsuleHeight = cf.GetFloat(p, v); }, |
1074 | (s) => { return s.m_params[0].avatarCapsuleHeight; }, | 1067 | (s) => { return s.m_params[0].avatarCapsuleHeight; }, |
1075 | (s,p,l,v) => { s.UpdateParameterAvatars(ref s.m_params[0].avatarCapsuleHeight, p, l, v); } ), | 1068 | (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].avatarCapsuleHeight, p, l, v); } ), |
1076 | new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", | 1069 | new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", |
1077 | 0.1f, | 1070 | 0.1f, |
1078 | (s,cf,p,v) => { s.m_params[0].avatarContactProcessingThreshold = cf.GetFloat(p, v); }, | 1071 | (s,cf,p,v) => { s.m_params[0].avatarContactProcessingThreshold = cf.GetFloat(p, v); }, |
1079 | (s) => { return s.m_params[0].avatarContactProcessingThreshold; }, | 1072 | (s) => { return s.m_params[0].avatarContactProcessingThreshold; }, |
1080 | (s,p,l,v) => { s.UpdateParameterAvatars(ref s.m_params[0].avatarContactProcessingThreshold, p, l, v); } ), | 1073 | (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].avatarContactProcessingThreshold, p, l, v); } ), |
1081 | 1074 | ||
1082 | 1075 | ||
1083 | new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", | 1076 | new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", |
@@ -1264,18 +1257,10 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
1264 | } | 1257 | } |
1265 | 1258 | ||
1266 | // check to see if we are updating a parameter for a particular or all of the prims | 1259 | // check to see if we are updating a parameter for a particular or all of the prims |
1267 | protected void UpdateParameterPrims(ref float loc, string parm, uint localID, float val) | 1260 | protected void UpdateParameterObject(ref float loc, string parm, uint localID, float val) |
1268 | { | ||
1269 | List<uint> operateOn; | ||
1270 | lock (m_prims) operateOn = new List<uint>(m_prims.Keys); | ||
1271 | UpdateParameterSet(operateOn, ref loc, parm, localID, val); | ||
1272 | } | ||
1273 | |||
1274 | // check to see if we are updating a parameter for a particular or all of the avatars | ||
1275 | protected void UpdateParameterAvatars(ref float loc, string parm, uint localID, float val) | ||
1276 | { | 1261 | { |
1277 | List<uint> operateOn; | 1262 | List<uint> operateOn; |
1278 | lock (m_avatars) operateOn = new List<uint>(m_avatars.Keys); | 1263 | lock (PhysObjects) operateOn = new List<uint>(PhysObjects.Keys); |
1279 | UpdateParameterSet(operateOn, ref loc, parm, localID, val); | 1264 | UpdateParameterSet(operateOn, ref loc, parm, localID, val); |
1280 | } | 1265 | } |
1281 | 1266 | ||