diff options
author | Robert Adams | 2012-12-13 12:42:25 -0800 |
---|---|---|
committer | Robert Adams | 2012-12-13 16:32:06 -0800 |
commit | 3b2b785a461eba34c26a45be246c2baef2820e39 (patch) | |
tree | 10f25858b084edcd6e58af0fb220b893260ddf5d /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |
parent | BulletSim: remove extra linkset rebuilds. (diff) | |
download | opensim-SC-3b2b785a461eba34c26a45be246c2baef2820e39.zip opensim-SC-3b2b785a461eba34c26a45be246c2baef2820e39.tar.gz opensim-SC-3b2b785a461eba34c26a45be246c2baef2820e39.tar.bz2 opensim-SC-3b2b785a461eba34c26a45be246c2baef2820e39.tar.xz |
BulletSim: Add 'BulletSimData' which separates structures created
for the operation of BulletSim and those defintiions/structures defined
so they can be used in the unmanaged world.
Consolidate setting of collision flags so implementation is not scattered.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 19c29cc..c9c9c2c 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -661,14 +661,7 @@ public sealed class BSPrim : BSPhysObject | |||
661 | BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, PhysBody.ptr); | 661 | BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, PhysBody.ptr); |
662 | 662 | ||
663 | // Collision filter can be set only when the object is in the world | 663 | // Collision filter can be set only when the object is in the world |
664 | if (PhysBody.collisionGroup != 0 || PhysBody.collisionMask != 0) | 664 | PhysBody.ApplyCollisionMask(); |
665 | { | ||
666 | if (!BulletSimAPI.SetCollisionGroupMask2(PhysBody.ptr, (uint)PhysBody.collisionGroup, (uint)PhysBody.collisionMask)) | ||
667 | { | ||
668 | PhysicsScene.Logger.ErrorFormat("{0} Failure setting prim collision mask. localID={1}, grp={2:X}, mask={3:X}", | ||
669 | LogHeader, LocalID, PhysBody.collisionGroup, PhysBody.collisionMask); | ||
670 | } | ||
671 | } | ||
672 | 665 | ||
673 | // Recompute any linkset parameters. | 666 | // Recompute any linkset parameters. |
674 | // When going from non-physical to physical, this re-enables the constraints that | 667 | // When going from non-physical to physical, this re-enables the constraints that |
@@ -713,11 +706,11 @@ public sealed class BSPrim : BSPhysObject | |||
713 | // Start it out sleeping and physical actions could wake it up. | 706 | // Start it out sleeping and physical actions could wake it up. |
714 | BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.ISLAND_SLEEPING); | 707 | BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.ISLAND_SLEEPING); |
715 | 708 | ||
709 | // This collides like a static object | ||
710 | PhysBody.collisionType = CollisionType.Static; | ||
711 | |||
716 | // There can be special things needed for implementing linksets | 712 | // There can be special things needed for implementing linksets |
717 | Linkset.MakeStatic(this); | 713 | Linkset.MakeStatic(this); |
718 | |||
719 | PhysBody.collisionGroup = CollisionFilterGroups.StaticObjectGroup; | ||
720 | PhysBody.collisionMask = CollisionFilterGroups.StaticObjectMask; | ||
721 | } | 714 | } |
722 | else | 715 | else |
723 | { | 716 | { |
@@ -755,16 +748,15 @@ public sealed class BSPrim : BSPhysObject | |||
755 | BulletSimAPI.SetSleepingThresholds2(PhysBody.ptr, PhysicsScene.Params.linearSleepingThreshold, PhysicsScene.Params.angularSleepingThreshold); | 748 | BulletSimAPI.SetSleepingThresholds2(PhysBody.ptr, PhysicsScene.Params.linearSleepingThreshold, PhysicsScene.Params.angularSleepingThreshold); |
756 | BulletSimAPI.SetContactProcessingThreshold2(PhysBody.ptr, PhysicsScene.Params.contactProcessingThreshold); | 749 | BulletSimAPI.SetContactProcessingThreshold2(PhysBody.ptr, PhysicsScene.Params.contactProcessingThreshold); |
757 | 750 | ||
758 | // There might be special things needed for implementing linksets. | 751 | // This collides like an object. |
759 | Linkset.MakeDynamic(this); | 752 | PhysBody.collisionType = CollisionType.Dynamic; |
760 | 753 | ||
761 | // Force activation of the object so Bullet will act on it. | 754 | // Force activation of the object so Bullet will act on it. |
762 | // Must do the ForceActivationState2() to overcome the DISABLE_SIMULATION from static objects. | 755 | // Must do the ForceActivationState2() to overcome the DISABLE_SIMULATION from static objects. |
763 | BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.ACTIVE_TAG); | 756 | BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.ACTIVE_TAG); |
764 | // BulletSimAPI.Activate2(BSBody.ptr, true); | ||
765 | 757 | ||
766 | PhysBody.collisionGroup = CollisionFilterGroups.ObjectGroup; | 758 | // There might be special things needed for implementing linksets. |
767 | PhysBody.collisionMask = CollisionFilterGroups.ObjectMask; | 759 | Linkset.MakeDynamic(this); |
768 | } | 760 | } |
769 | } | 761 | } |
770 | 762 | ||
@@ -791,8 +783,9 @@ public sealed class BSPrim : BSPhysObject | |||
791 | m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for non-solidness. id={1}, type={2}", LogHeader, LocalID, bodyType); | 783 | m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for non-solidness. id={1}, type={2}", LogHeader, LocalID, bodyType); |
792 | } | 784 | } |
793 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); | 785 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); |
794 | PhysBody.collisionGroup = CollisionFilterGroups.VolumeDetectGroup; | 786 | |
795 | PhysBody.collisionMask = CollisionFilterGroups.VolumeDetectMask; | 787 | // Change collision info from a static object to a ghosty collision object |
788 | PhysBody.collisionType = CollisionType.VolumeDetect; | ||
796 | } | 789 | } |
797 | } | 790 | } |
798 | 791 | ||