aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
diff options
context:
space:
mode:
authorRobert Adams2012-08-03 14:44:07 -0700
committerRobert Adams2012-08-03 15:09:56 -0700
commite7ad6ed3a3fda013cd393df6bb50236871092249 (patch)
treedd8b6b28ae7226c28a8b3a07a893ea24ecb24fb8 /OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
parentBulletSim: Add AddObjectForce to BulletSim API. (diff)
downloadopensim-SC-e7ad6ed3a3fda013cd393df6bb50236871092249.zip
opensim-SC-e7ad6ed3a3fda013cd393df6bb50236871092249.tar.gz
opensim-SC-e7ad6ed3a3fda013cd393df6bb50236871092249.tar.bz2
opensim-SC-e7ad6ed3a3fda013cd393df6bb50236871092249.tar.xz
BulletSim: pass collision subscription information to the C++ code so collisions on objects that don't care are not reported up.
Diffstat (limited to '')
-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() {