aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
diff options
context:
space:
mode:
authorRobert Adams2012-03-26 17:36:33 -0700
committerRobert Adams2012-03-26 17:36:33 -0700
commit872d513daaa68b94b78f71bd2a2d9a0f117ff727 (patch)
tree3f526fbad3394fa41a86e4aa6aa0a934c9119f3b /OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
parentBulletSim: update BulletSim binaries and configuration fixing a crash which h... (diff)
downloadopensim-SC_OLD-872d513daaa68b94b78f71bd2a2d9a0f117ff727.zip
opensim-SC_OLD-872d513daaa68b94b78f71bd2a2d9a0f117ff727.tar.gz
opensim-SC_OLD-872d513daaa68b94b78f71bd2a2d9a0f117ff727.tar.bz2
opensim-SC_OLD-872d513daaa68b94b78f71bd2a2d9a0f117ff727.tar.xz
BulletSim: make avatar animations update properly.
It seems that ODE calls the avatar collision handling routine even if there are no collisions. This causes the animation to be updated. So, for instance, going from HOVER to FLY is caused by the physics engine calling the collision routine each frame with 0 collisions.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 581d540..94a0ccf 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -78,6 +78,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters
78 78
79 private Dictionary<uint, BSCharacter> m_avatars = new Dictionary<uint, BSCharacter>(); 79 private Dictionary<uint, BSCharacter> m_avatars = new Dictionary<uint, BSCharacter>();
80 private Dictionary<uint, BSPrim> m_prims = new Dictionary<uint, BSPrim>(); 80 private Dictionary<uint, BSPrim> m_prims = new Dictionary<uint, BSPrim>();
81 private HashSet<BSCharacter> m_avatarsWithCollisions = new HashSet<BSCharacter>();
82 private HashSet<BSPrim> m_primsWithCollisions = new HashSet<BSPrim>();
81 private List<BSPrim> m_vehicles = new List<BSPrim>(); 83 private List<BSPrim> m_vehicles = new List<BSPrim>();
82 private float[] m_heightMap; 84 private float[] m_heightMap;
83 private float m_waterLevel; 85 private float m_waterLevel;
@@ -435,6 +437,17 @@ public class BSScene : PhysicsScene, IPhysicsParameters
435 } 437 }
436 } 438 }
437 439
440 // The SendCollision's batch up the collisions on the objects. Now push the collisions into the simulator.
441 foreach (BSPrim bsp in m_primsWithCollisions)
442 bsp.SendCollisions();
443 m_primsWithCollisions.Clear();
444 // foreach (BSCharacter bsc in m_avatarsWithCollisions)
445 // bsc.SendCollisions();
446 // This is a kludge to get avatar movement updated. ODE sends collisions even if there isn't any
447 foreach (KeyValuePair<uint, BSCharacter> kvp in m_avatars)
448 kvp.Value.SendCollisions();
449 m_avatarsWithCollisions.Clear();
450
438 // If any of the objects had updated properties, tell the object it has been changed by the physics engine 451 // If any of the objects had updated properties, tell the object it has been changed by the physics engine
439 if (updatedEntityCount > 0) 452 if (updatedEntityCount > 0)
440 { 453 {
@@ -485,11 +498,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters
485 BSPrim prim; 498 BSPrim prim;
486 if (m_prims.TryGetValue(localID, out prim)) { 499 if (m_prims.TryGetValue(localID, out prim)) {
487 prim.Collide(collidingWith, type, collidePoint, collideNormal, penitration); 500 prim.Collide(collidingWith, type, collidePoint, collideNormal, penitration);
501 m_primsWithCollisions.Add(prim);
488 return; 502 return;
489 } 503 }
490 BSCharacter actor; 504 BSCharacter actor;
491 if (m_avatars.TryGetValue(localID, out actor)) { 505 if (m_avatars.TryGetValue(localID, out actor)) {
492 actor.Collide(collidingWith, type, collidePoint, collideNormal, penitration); 506 actor.Collide(collidingWith, type, collidePoint, collideNormal, penitration);
507 m_avatarsWithCollisions.Add(actor);
493 return; 508 return;
494 } 509 }
495 return; 510 return;