aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs6
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs11
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs3
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs4
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs16
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs2
6 files changed, 25 insertions, 17 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 38609e3..819635a 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -89,7 +89,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
89 89
90 //Angular properties 90 //Angular properties
91 private Vector3 m_angularMotorDirection = Vector3.Zero; // angular velocity requested by LSL motor 91 private Vector3 m_angularMotorDirection = Vector3.Zero; // angular velocity requested by LSL motor
92 private int m_angularMotorApply = 0; // application frame counter 92 // private int m_angularMotorApply = 0; // application frame counter
93 private Vector3 m_angularMotorVelocity = Vector3.Zero; // current angular motor velocity 93 private Vector3 m_angularMotorVelocity = Vector3.Zero; // current angular motor velocity
94 private float m_angularMotorTimescale = 0; // motor angular velocity ramp up rate 94 private float m_angularMotorTimescale = 0; // motor angular velocity ramp up rate
95 private float m_angularMotorDecayTimescale = 0; // motor angular velocity decay rate 95 private float m_angularMotorDecayTimescale = 0; // motor angular velocity decay rate
@@ -199,7 +199,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
199 break; 199 break;
200 case Vehicle.ANGULAR_MOTOR_DIRECTION: 200 case Vehicle.ANGULAR_MOTOR_DIRECTION:
201 m_angularMotorDirection = new Vector3(pValue, pValue, pValue); 201 m_angularMotorDirection = new Vector3(pValue, pValue, pValue);
202 m_angularMotorApply = 100; 202 // m_angularMotorApply = 100;
203 break; 203 break;
204 case Vehicle.LINEAR_FRICTION_TIMESCALE: 204 case Vehicle.LINEAR_FRICTION_TIMESCALE:
205 m_linearFrictionTimescale = new Vector3(pValue, pValue, pValue); 205 m_linearFrictionTimescale = new Vector3(pValue, pValue, pValue);
@@ -229,7 +229,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
229 pValue.Y = Math.Max(-12.56f, Math.Min(pValue.Y, 12.56f)); 229 pValue.Y = Math.Max(-12.56f, Math.Min(pValue.Y, 12.56f));
230 pValue.Z = Math.Max(-12.56f, Math.Min(pValue.Z, 12.56f)); 230 pValue.Z = Math.Max(-12.56f, Math.Min(pValue.Z, 12.56f));
231 m_angularMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z); 231 m_angularMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z);
232 m_angularMotorApply = 100; 232 // m_angularMotorApply = 100;
233 break; 233 break;
234 case Vehicle.LINEAR_FRICTION_TIMESCALE: 234 case Vehicle.LINEAR_FRICTION_TIMESCALE:
235 m_linearFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z); 235 m_linearFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index 6e68695..12c6d7a 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -83,8 +83,8 @@ public sealed class BSLinksetCompound : BSLinkset
83 public override bool MakeDynamic(BSPhysObject child) 83 public override bool MakeDynamic(BSPhysObject child)
84 { 84 {
85 bool ret = false; 85 bool ret = false;
86 DetailLog("{0},BSLinksetCompound.MakeDynamic,call,isChild={1}", child.LocalID, HasChild(child)); 86 DetailLog("{0},BSLinksetCompound.MakeDynamic,call,IsRoot={1}", child.LocalID, IsRoot(child));
87 if (HasChild(child)) 87 if (!IsRoot(child))
88 { 88 {
89 // Physical children are removed from the world as the shape ofthe root compound 89 // Physical children are removed from the world as the shape ofthe root compound
90 // shape takes over. 90 // shape takes over.
@@ -103,8 +103,8 @@ public sealed class BSLinksetCompound : BSLinkset
103 public override bool MakeStatic(BSPhysObject child) 103 public override bool MakeStatic(BSPhysObject child)
104 { 104 {
105 bool ret = false; 105 bool ret = false;
106 DetailLog("{0},BSLinksetCompound.MakeStatic,call,hasChild={1}", child.LocalID, HasChild(child)); 106 DetailLog("{0},BSLinksetCompound.MakeStatic,call,IsRoot={1}", child.LocalID, IsRoot(child));
107 if (HasChild(child)) 107 if (!IsRoot(child))
108 { 108 {
109 // The non-physical children can come back to life. 109 // The non-physical children can come back to life.
110 BulletSimAPI.RemoveFromCollisionFlags2(child.PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); 110 BulletSimAPI.RemoveFromCollisionFlags2(child.PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE);
@@ -240,6 +240,7 @@ public sealed class BSLinksetCompound : BSLinkset
240 // A mesh or hull is created because scale is not available on a native shape. 240 // A mesh or hull is created because scale is not available on a native shape.
241 // (TODO: Bullet does have a btScaledCollisionShape. Can that be used?) 241 // (TODO: Bullet does have a btScaledCollisionShape. Can that be used?)
242 BulletShape saveShape = cPrim.PhysShape; 242 BulletShape saveShape = cPrim.PhysShape;
243 cPrim.PhysShape.ptr = IntPtr.Zero; // Don't let the create free the child's shape
243 PhysicsScene.Shapes.CreateGeomMeshOrHull(cPrim, null); 244 PhysicsScene.Shapes.CreateGeomMeshOrHull(cPrim, null);
244 BulletShape newShape = cPrim.PhysShape; 245 BulletShape newShape = cPrim.PhysShape;
245 cPrim.PhysShape = saveShape; 246 cPrim.PhysShape = saveShape;
@@ -263,7 +264,7 @@ public sealed class BSLinksetCompound : BSLinkset
263 float linksetMass = LinksetMass; 264 float linksetMass = LinksetMass;
264 LinksetRoot.UpdatePhysicalMassProperties(linksetMass); 265 LinksetRoot.UpdatePhysicalMassProperties(linksetMass);
265 266
266 // DEBUG: see of inter-linkset collisions are causing problems 267 // DEBUG: see of inter-linkset collisions are causing problems for constraint linksets.
267 // BulletSimAPI.SetCollisionFilterMask2(LinksetRoot.BSBody.ptr, 268 // BulletSimAPI.SetCollisionFilterMask2(LinksetRoot.BSBody.ptr,
268 // (uint)CollisionFilterGroups.LinksetFilter, (uint)CollisionFilterGroups.LinksetMask); 269 // (uint)CollisionFilterGroups.LinksetFilter, (uint)CollisionFilterGroups.LinksetMask);
269 270
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index af403aa..aaa0d93 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -703,6 +703,9 @@ public sealed class BSPrim : BSPhysObject
703 // For good measure, make sure the transform is set through to the motion state 703 // For good measure, make sure the transform is set through to the motion state
704 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 704 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
705 705
706 // Center of mass is at the center of the object
707 BulletSimAPI.SetCenterOfMassByPosRot2(Linkset.LinksetRoot.PhysBody.ptr, _position, _orientation);
708
706 // A dynamic object has mass 709 // A dynamic object has mass
707 UpdatePhysicalMassProperties(RawMass); 710 UpdatePhysicalMassProperties(RawMass);
708 711
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index c2e0ef1..740f339 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -1391,7 +1391,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
1391 // If the local ID is APPLY_TO_NONE, just change the default value 1391 // If the local ID is APPLY_TO_NONE, just change the default value
1392 // If the localID is APPLY_TO_ALL change the default value and apply the new value to all the lIDs 1392 // If the localID is APPLY_TO_ALL change the default value and apply the new value to all the lIDs
1393 // If the localID is a specific object, apply the parameter change to only that object 1393 // If the localID is a specific object, apply the parameter change to only that object
1394 protected void UpdateParameterObject(ref float defaultLoc, string parm, uint localID, float val) 1394 private void UpdateParameterObject(ref float defaultLoc, string parm, uint localID, float val)
1395 { 1395 {
1396 List<uint> objectIDs = new List<uint>(); 1396 List<uint> objectIDs = new List<uint>();
1397 switch (localID) 1397 switch (localID)
@@ -1416,7 +1416,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
1416 } 1416 }
1417 1417
1418 // schedule the actual updating of the paramter to when the phys engine is not busy 1418 // schedule the actual updating of the paramter to when the phys engine is not busy
1419 protected void TaintedUpdateParameter(string parm, List<uint> lIDs, float val) 1419 private void TaintedUpdateParameter(string parm, List<uint> lIDs, float val)
1420 { 1420 {
1421 float xval = val; 1421 float xval = val;
1422 List<uint> xlIDs = lIDs; 1422 List<uint> xlIDs = lIDs;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index 4a31c7d..29a23c0 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -38,7 +38,7 @@ public sealed class BSShapeCollection : IDisposable
38{ 38{
39 private static string LogHeader = "[BULLETSIM SHAPE COLLECTION]"; 39 private static string LogHeader = "[BULLETSIM SHAPE COLLECTION]";
40 40
41 protected BSScene PhysicsScene { get; set; } 41 private BSScene PhysicsScene { get; set; }
42 42
43 private Object m_collectionActivityLock = new Object(); 43 private Object m_collectionActivityLock = new Object();
44 44
@@ -103,11 +103,12 @@ public sealed class BSShapeCollection : IDisposable
103 { 103 {
104 // Do we have the correct geometry for this type of object? 104 // Do we have the correct geometry for this type of object?
105 // Updates prim.BSShape with information/pointers to shape. 105 // Updates prim.BSShape with information/pointers to shape.
106 // CreateGeom returns 'true' of BSShape as changed to a new shape. 106 // Returns 'true' of BSShape is changed to a new shape.
107 bool newGeom = CreateGeom(forceRebuild, prim, shapeCallback); 107 bool newGeom = CreateGeom(forceRebuild, prim, shapeCallback);
108 // If we had to select a new shape geometry for the object, 108 // If we had to select a new shape geometry for the object,
109 // rebuild the body around it. 109 // rebuild the body around it.
110 // Updates prim.BSBody with information/pointers to requested body 110 // Updates prim.BSBody with information/pointers to requested body
111 // Returns 'true' if BSBody was changed.
111 bool newBody = CreateBody((newGeom || forceRebuild), prim, PhysicsScene.World, 112 bool newBody = CreateBody((newGeom || forceRebuild), prim, PhysicsScene.World,
112 prim.PhysShape, bodyCallback); 113 prim.PhysShape, bodyCallback);
113 ret = newGeom || newBody; 114 ret = newGeom || newBody;
@@ -431,6 +432,7 @@ public sealed class BSShapeCollection : IDisposable
431 return ret; 432 return ret;
432 } 433 }
433 434
435 // Create a mesh/hull shape or a native shape if 'nativeShapePossible' is 'true'.
434 private bool CreateGeomNonSpecial(bool forceRebuild, BSPhysObject prim, ShapeDestructionCallback shapeCallback) 436 private bool CreateGeomNonSpecial(bool forceRebuild, BSPhysObject prim, ShapeDestructionCallback shapeCallback)
435 { 437 {
436 bool ret = false; 438 bool ret = false;
@@ -797,15 +799,17 @@ public sealed class BSShapeCollection : IDisposable
797 private bool GetReferenceToCompoundShape(BSPhysObject prim, ShapeDestructionCallback shapeCallback) 799 private bool GetReferenceToCompoundShape(BSPhysObject prim, ShapeDestructionCallback shapeCallback)
798 { 800 {
799 // Remove reference to the old shape 801 // Remove reference to the old shape
800 // Don't need to do this as the shape is freed when we create the new root shape below. 802 // Don't need to do this as the shape is freed when the new root shape is created below.
801 // DereferenceShape(prim.PhysShape, true, shapeCallback); 803 // DereferenceShape(prim.PhysShape, true, shapeCallback);
802 804
803 BulletShape cShape = new BulletShape( 805 BulletShape cShape = new BulletShape(
804 BulletSimAPI.CreateCompoundShape2(PhysicsScene.World.ptr), ShapeData.PhysicsShapeType.SHAPE_COMPOUND); 806 BulletSimAPI.CreateCompoundShape2(PhysicsScene.World.ptr, false), ShapeData.PhysicsShapeType.SHAPE_COMPOUND);
805 807
806 // Create the shape for the root prim and add it to the compound shape 808 // Create the shape for the root prim and add it to the compound shape. Cannot be a native shape.
807 CreateGeomNonSpecial(true, prim, null); 809 CreateGeomMeshOrHull(prim, shapeCallback);
808 BulletSimAPI.AddChildShapeToCompoundShape2(cShape.ptr, prim.PhysShape.ptr, OMV.Vector3.Zero, OMV.Quaternion.Identity); 810 BulletSimAPI.AddChildShapeToCompoundShape2(cShape.ptr, prim.PhysShape.ptr, OMV.Vector3.Zero, OMV.Quaternion.Identity);
811 DetailLog("{0},BSShapeCollection.GetReferenceToCompoundShape,addRootPrim,compShape={1},rootShape={2}",
812 prim.LocalID, cShape, prim.PhysShape);
809 813
810 prim.PhysShape = cShape; 814 prim.PhysShape = cShape;
811 815
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index ac6d2b2..702bd77 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -614,7 +614,7 @@ public static extern bool IsNativeShape2(IntPtr shape);
614public static extern IntPtr BuildCapsuleShape2(IntPtr world, float radius, float height, Vector3 scale); 614public static extern IntPtr BuildCapsuleShape2(IntPtr world, float radius, float height, Vector3 scale);
615 615
616[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 616[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
617public static extern IntPtr CreateCompoundShape2(IntPtr sim); 617public static extern IntPtr CreateCompoundShape2(IntPtr sim, bool enableDynamicAabbTree);
618 618
619[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 619[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
620public static extern int GetNumberOfCompoundChildren2(IntPtr cShape); 620public static extern int GetNumberOfCompoundChildren2(IntPtr cShape);