diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index fa22c78..a9b1365 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -131,8 +131,6 @@ public class BSCharacter : BSPhysObject | |||
131 | BulletSimAPI.SetObjectBuoyancy(Scene.WorldID, LocalID, _buoyancy); | 131 | BulletSimAPI.SetObjectBuoyancy(Scene.WorldID, LocalID, _buoyancy); |
132 | 132 | ||
133 | BSBody = new BulletBody(LocalID, BulletSimAPI.GetBodyHandle2(Scene.World.Ptr, LocalID)); | 133 | BSBody = new BulletBody(LocalID, BulletSimAPI.GetBodyHandle2(Scene.World.Ptr, LocalID)); |
134 | // avatars get all collisions no matter what (makes walking on ground and such work) | ||
135 | BulletSimAPI.AddToCollisionFlags2(BSBody.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | ||
136 | }); | 134 | }); |
137 | 135 | ||
138 | return; | 136 | return; |
@@ -480,11 +478,10 @@ public class BSCharacter : BSPhysObject | |||
480 | // Stop collision events | 478 | // Stop collision events |
481 | public override void UnSubscribeEvents() { | 479 | public override void UnSubscribeEvents() { |
482 | _subscribedEventsMs = 0; | 480 | _subscribedEventsMs = 0; |
483 | // Avatars get all their collision events | 481 | Scene.TaintedObject("BSCharacter.UnSubscribeEvents", delegate() |
484 | // Scene.TaintedObject("BSCharacter.UnSubscribeEvents", delegate() | 482 | { |
485 | // { | 483 | BulletSimAPI.RemoveFromCollisionFlags2(BSBody.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); |
486 | // BulletSimAPI.RemoveFromCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | 484 | }); |
487 | // }); | ||
488 | } | 485 | } |
489 | // Return 'true' if someone has subscribed to events | 486 | // Return 'true' if someone has subscribed to events |
490 | public override bool SubscribedEvents() { | 487 | public override bool SubscribedEvents() { |
@@ -532,10 +529,12 @@ public class BSCharacter : BSPhysObject | |||
532 | // The collision, if it should be reported to the character, is placed in a collection | 529 | // The collision, if it should be reported to the character, is placed in a collection |
533 | // that will later be sent to the simulator when SendCollisions() is called. | 530 | // that will later be sent to the simulator when SendCollisions() is called. |
534 | CollisionEventUpdate collisionCollection = null; | 531 | CollisionEventUpdate collisionCollection = null; |
535 | public override void Collide(uint collidingWith, BSPhysObject collidee, ActorTypes type, Vector3 contactPoint, Vector3 contactNormal, float pentrationDepth) | 532 | public override bool Collide(uint collidingWith, BSPhysObject collidee, ActorTypes type, Vector3 contactPoint, Vector3 contactNormal, float pentrationDepth) |
536 | { | 533 | { |
537 | // m_log.DebugFormat("{0}: Collide: ms={1}, id={2}, with={3}", LogHeader, _subscribedEventsMs, LocalID, collidingWith); | 534 | // m_log.DebugFormat("{0}: Collide: ms={1}, id={2}, with={3}", LogHeader, _subscribedEventsMs, LocalID, collidingWith); |
538 | 535 | ||
536 | bool ret = false; | ||
537 | |||
539 | // The following makes IsColliding() and IsCollidingGround() work | 538 | // The following makes IsColliding() and IsCollidingGround() work |
540 | _collidingStep = Scene.SimulationStep; | 539 | _collidingStep = Scene.SimulationStep; |
541 | if (collidingWith == BSScene.TERRAIN_ID || collidingWith == BSScene.GROUNDPLANE_ID) | 540 | if (collidingWith == BSScene.TERRAIN_ID || collidingWith == BSScene.GROUNDPLANE_ID) |
@@ -553,8 +552,10 @@ public class BSCharacter : BSPhysObject | |||
553 | if (collisionCollection == null) | 552 | if (collisionCollection == null) |
554 | collisionCollection = new CollisionEventUpdate(); | 553 | collisionCollection = new CollisionEventUpdate(); |
555 | collisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); | 554 | collisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); |
555 | ret = true; | ||
556 | } | 556 | } |
557 | } | 557 | } |
558 | return ret; | ||
558 | } | 559 | } |
559 | 560 | ||
560 | public override void SendCollisions() | 561 | public override void SendCollisions() |