diff options
author | Robert Adams | 2012-09-13 08:11:54 -0700 |
---|---|---|
committer | Robert Adams | 2012-09-15 15:31:29 -0700 |
commit | 2c5ff9399063080276a23bcd06fb696d653bef2e (patch) | |
tree | 3428eaff2697b562880c75f5f83eafcbb855c93e /OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |
parent | Add basic asset connector tests to check behaviour for normal, local and temp... (diff) | |
download | opensim-SC-2c5ff9399063080276a23bcd06fb696d653bef2e.zip opensim-SC-2c5ff9399063080276a23bcd06fb696d653bef2e.tar.gz opensim-SC-2c5ff9399063080276a23bcd06fb696d653bef2e.tar.bz2 opensim-SC-2c5ff9399063080276a23bcd06fb696d653bef2e.tar.xz |
BulletSim: Way too many changes in one commit.
Many changes to BSDynamic for readability and commentary.
Linkset hacking for vehicles: don't over mass the root prim.
Add parameter for link constraint solver iterations.
Correct uses of timestep in timescale calculations for vehicles.
Reorganize code/logic for making objects static and dynamic for readability
and use of API2.
Changed most calls in BSPrim to use API2 calls (the new way).
Avatars do not generate default Bullet collision events but do call up
to the simulator for every avatar. Reduces overhead.
Objects added to collision list only if they are processing collisions.
Reduces overhead especially for large numbers of avatars.
Generalize call for water height to GetWaterHeightAtXYZ().
Catch and correct exception getting terrain height when out of bounds.
Correct race condition in Terrain Manager where creation wasn't at taint-time.
Add API calls for constructing compound shapes.
Move NeedsMeshing() logic into object class.
Reorganize logic for object meshing to reduce rebuilding of meshs/hulls.
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() |