aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.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/BSCharacter.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/BSCharacter.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs24
1 files changed, 20 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 20708d9..b08d5db 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -426,6 +426,8 @@ public class BSCharacter : PhysicsActor
426 } 426 }
427 } 427 }
428 428
429 // Called by the scene when a collision with this object is reported
430 CollisionEventUpdate collisionCollection = null;
429 public void Collide(uint collidingWith, ActorTypes type, Vector3 contactPoint, Vector3 contactNormal, float pentrationDepth) 431 public void Collide(uint collidingWith, ActorTypes type, Vector3 contactPoint, Vector3 contactNormal, float pentrationDepth)
430 { 432 {
431 // m_log.DebugFormat("{0}: Collide: ms={1}, id={2}, with={3}", LogHeader, _subscribedEventsMs, LocalID, collidingWith); 433 // m_log.DebugFormat("{0}: Collide: ms={1}, id={2}, with={3}", LogHeader, _subscribedEventsMs, LocalID, collidingWith);
@@ -443,10 +445,24 @@ public class BSCharacter : PhysicsActor
443 if (nowTime < (_lastCollisionTime + _subscribedEventsMs)) return; 445 if (nowTime < (_lastCollisionTime + _subscribedEventsMs)) return;
444 _lastCollisionTime = nowTime; 446 _lastCollisionTime = nowTime;
445 447
446 Dictionary<uint, ContactPoint> contactPoints = new Dictionary<uint, ContactPoint>(); 448 if (collisionCollection == null)
447 contactPoints.Add(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); 449 collisionCollection = new CollisionEventUpdate();
448 CollisionEventUpdate args = new CollisionEventUpdate(contactPoints); 450 collisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth));
449 base.SendCollisionUpdate(args); 451 }
452
453 public void SendCollisions()
454 {
455 // if (collisionCollection != null)
456 // {
457 // base.SendCollisionUpdate(collisionCollection);
458 // collisionCollection = null;
459 // }
460 // Kludge to make a collision call even if there are no collisions.
461 // This causes the avatar animation to get updated.
462 if (collisionCollection == null)
463 collisionCollection = new CollisionEventUpdate();
464 base.SendCollisionUpdate(collisionCollection);
465 collisionCollection = null;
450 } 466 }
451 467
452} 468}