aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorRobert Adams2012-08-31 13:32:22 -0700
committerRobert Adams2012-09-07 16:05:11 -0700
commit76dc29dc379036aa44f1ef78782f7ac94760a80f (patch)
treea9007f98060ae4ee6dbd9d10cebfc56578c2b437 /OpenSim/Region
parentrenaming to markdown file (diff)
downloadopensim-SC-76dc29dc379036aa44f1ef78782f7ac94760a80f.zip
opensim-SC-76dc29dc379036aa44f1ef78782f7ac94760a80f.tar.gz
opensim-SC-76dc29dc379036aa44f1ef78782f7ac94760a80f.tar.bz2
opensim-SC-76dc29dc379036aa44f1ef78782f7ac94760a80f.tar.xz
BulletSim: Modify collision flag calls to return the current flags.
Track current collision flags in BSPrim. Add BulletSimAPI calls for saving and restoring rigidBodies using construction information structure.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs9
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs16
2 files changed, 18 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 6bfce5c..6fcd416 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -94,6 +94,7 @@ public sealed class BSPrim : BSPhysObject
94 private int _nextCollisionOkTime = 0; 94 private int _nextCollisionOkTime = 0;
95 long _collidingStep; 95 long _collidingStep;
96 long _collidingGroundStep; 96 long _collidingGroundStep;
97 CollisionFlags m_currentCollisionFlags = 0;
97 98
98 public override BulletBody Body { get; set; } 99 public override BulletBody Body { get; set; }
99 100
@@ -143,6 +144,7 @@ public sealed class BSPrim : BSPhysObject
143 // At the moment, we're still letting BulletSim manage the creation and destruction 144 // At the moment, we're still letting BulletSim manage the creation and destruction
144 // of the object. Someday we'll move that into the C# code. 145 // of the object. Someday we'll move that into the C# code.
145 Body = new BulletBody(LocalID, BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID)); 146 Body = new BulletBody(LocalID, BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID));
147 m_currentCollisionFlags = BulletSimAPI.GetCollisionFlags2(Body.Ptr);
146 }); 148 });
147 } 149 }
148 150
@@ -483,8 +485,7 @@ public sealed class BSPrim : BSPhysObject
483 // recompute any linkset parameters 485 // recompute any linkset parameters
484 Linkset.Refresh(this); 486 Linkset.Refresh(this);
485 487
486 CollisionFlags cf = BulletSimAPI.GetCollisionFlags2(Body.Ptr); 488 DetailLog("{0},BSPrim.SetObjectDynamic,taint,static={1},solid={2},mass={3}, cf={4}", LocalID, IsStatic, IsSolid, mass, m_currentCollisionFlags);
487 DetailLog("{0},BSPrim.SetObjectDynamic,taint,static={1},solid={2},mass={3}, cf={4}", LocalID, IsStatic, IsSolid, mass, cf);
488 } 489 }
489 490
490 // prims don't fly 491 // prims don't fly
@@ -644,7 +645,7 @@ public sealed class BSPrim : BSPhysObject
644 645
645 Scene.TaintedObject("BSPrim.SubscribeEvents", delegate() 646 Scene.TaintedObject("BSPrim.SubscribeEvents", delegate()
646 { 647 {
647 BulletSimAPI.AddToCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 648 m_currentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
648 }); 649 });
649 } 650 }
650 } 651 }
@@ -652,7 +653,7 @@ public sealed class BSPrim : BSPhysObject
652 _subscribedEventsMs = 0; 653 _subscribedEventsMs = 0;
653 Scene.TaintedObject("BSPrim.UnSubscribeEvents", delegate() 654 Scene.TaintedObject("BSPrim.UnSubscribeEvents", delegate()
654 { 655 {
655 BulletSimAPI.RemoveFromCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 656 m_currentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
656 }); 657 });
657 } 658 }
658 public override bool SubscribedEvents() { 659 public override bool SubscribedEvents() {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index a0bad3a..d28c14b 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -461,10 +461,20 @@ public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape);
461public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, Vector3 pos, Quaternion rot); 461public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, Vector3 pos, Quaternion rot);
462 462
463[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 463[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
464public static extern IntPtr CreateBodyFromShapeAndInfo2(IntPtr sim, IntPtr shape, IntPtr constructionInfo);
465
466[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
464public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, Vector3 pos, Quaternion rot); 467public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, Vector3 pos, Quaternion rot);
465 468
466[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 469[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
467public static extern bool SetBodyShape2(IntPtr sim, IntPtr obj, IntPtr shape); 470public static extern bool SetBodyShape2(IntPtr sim, IntPtr obj, IntPtr shape);
471
472[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
473public static extern IntPtr AllocateBodyInfo2(IntPtr obj);
474
475[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
476public static extern void ReleaseBodyInfo2(IntPtr obj);
477
468// ===================================================================================== 478// =====================================================================================
469[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 479[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
470public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords, 480public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords,
@@ -604,13 +614,13 @@ public static extern bool SetInterpolation2(IntPtr obj, Vector3 lin, Vector3 ang
604public static extern CollisionFlags GetCollisionFlags2(IntPtr obj); 614public static extern CollisionFlags GetCollisionFlags2(IntPtr obj);
605 615
606[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 616[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
607public static extern IntPtr SetCollisionFlags2(IntPtr obj, CollisionFlags flags); 617public static extern CollisionFlags SetCollisionFlags2(IntPtr obj, CollisionFlags flags);
608 618
609[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 619[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
610public static extern IntPtr AddToCollisionFlags2(IntPtr obj, CollisionFlags flags); 620public static extern CollisionFlags AddToCollisionFlags2(IntPtr obj, CollisionFlags flags);
611 621
612[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 622[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
613public static extern IntPtr RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags); 623public static extern CollisionFlags RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags);
614 624
615[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 625[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
616public static extern bool SetMassProps2(IntPtr obj, float mass, Vector3 inertia); 626public static extern bool SetMassProps2(IntPtr obj, float mass, Vector3 inertia);