aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs18
1 files changed, 17 insertions, 1 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index a5635ff..494f5a6 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -125,6 +125,8 @@ public class BSCharacter : PhysicsActor
125 BulletSimAPI.CreateObject(parent_scene.WorldID, shapeData); 125 BulletSimAPI.CreateObject(parent_scene.WorldID, shapeData);
126 126
127 m_body = new BulletBody(LocalID, BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID)); 127 m_body = new BulletBody(LocalID, BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID));
128 // avatars get all collisions no matter what
129 BulletSimAPI.AddToCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
128 }); 130 });
129 131
130 return; 132 return;
@@ -384,11 +386,25 @@ public class BSCharacter : PhysicsActor
384 // Turn on collision events at a rate no faster than one every the given milliseconds 386 // Turn on collision events at a rate no faster than one every the given milliseconds
385 public override void SubscribeEvents(int ms) { 387 public override void SubscribeEvents(int ms) {
386 _subscribedEventsMs = ms; 388 _subscribedEventsMs = ms;
387 _nextCollisionOkTime = Util.EnvironmentTickCount() - _subscribedEventsMs; // make first collision happen 389 if (ms > 0)
390 {
391 // make sure first collision happens
392 _nextCollisionOkTime = Util.EnvironmentTickCount() - _subscribedEventsMs;
393
394 Scene.TaintedObject(delegate()
395 {
396 BulletSimAPI.AddToCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
397 });
398 }
388 } 399 }
389 // Stop collision events 400 // Stop collision events
390 public override void UnSubscribeEvents() { 401 public override void UnSubscribeEvents() {
391 _subscribedEventsMs = 0; 402 _subscribedEventsMs = 0;
403 // Avatars get all their collision events
404 // Scene.TaintedObject(delegate()
405 // {
406 // BulletSimAPI.RemoveFromCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
407 // });
392 } 408 }
393 // Return 'true' if someone has subscribed to events 409 // Return 'true' if someone has subscribed to events
394 public override bool SubscribedEvents() { 410 public override bool SubscribedEvents() {