aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin
diff options
context:
space:
mode:
authorMelanie2013-01-18 19:35:09 +0000
committerMelanie2013-01-18 19:35:09 +0000
commit9aad815177c76580e74b941b8af429335d1c259c (patch)
treec0ea29b07d6178e5c1982fa52067787154101aa8 /OpenSim/Region/Physics/BulletSPlugin
parentMerge branch 'master' into careminster (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-9aad815177c76580e74b941b8af429335d1c259c.zip
opensim-SC-9aad815177c76580e74b941b8af429335d1c259c.tar.gz
opensim-SC-9aad815177c76580e74b941b8af429335d1c259c.tar.bz2
opensim-SC-9aad815177c76580e74b941b8af429335d1c259c.tar.xz
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs3
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs3
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs10
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs33
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt6
5 files changed, 31 insertions, 24 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 87a06c1..6d5e23f 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -652,6 +652,9 @@ public sealed class BSCharacter : BSPhysObject
652 public override bool IsStatic { 652 public override bool IsStatic {
653 get { return false; } 653 get { return false; }
654 } 654 }
655 public override bool IsPhysicallyActive {
656 get { return true; }
657 }
655 public override bool Flying { 658 public override bool Flying {
656 get { return _flying; } 659 get { return _flying; }
657 set { 660 set {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 6601479..f2c7cec 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -35,6 +35,7 @@ using System.Collections.Generic;
35using System.Reflection; 35using System.Reflection;
36using System.Runtime.InteropServices; 36using System.Runtime.InteropServices;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenSim.Framework;
38using OpenSim.Region.Physics.Manager; 39using OpenSim.Region.Physics.Manager;
39 40
40namespace OpenSim.Region.Physics.BulletSPlugin 41namespace OpenSim.Region.Physics.BulletSPlugin
@@ -154,7 +155,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
154 // Return 'true' if this vehicle is doing vehicle things 155 // Return 'true' if this vehicle is doing vehicle things
155 public bool IsActive 156 public bool IsActive
156 { 157 {
157 get { return (Type != Vehicle.TYPE_NONE && !Prim.IsStatic); } 158 get { return (Type != Vehicle.TYPE_NONE && Prim.IsPhysicallyActive); }
158 } 159 }
159 160
160 #region Vehicle parameter setting 161 #region Vehicle parameter setting
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index 821f470..bac0427 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -139,6 +139,11 @@ public abstract class BSPhysObject : PhysicsActor
139 public abstract bool IsStatic { get; } 139 public abstract bool IsStatic { get; }
140 public abstract bool IsSelected { get; } 140 public abstract bool IsSelected { get; }
141 141
142 // It can be confusing for an actor to know if it should move or update an object
143 // depeneding on the setting of 'selected', 'physical, ...
144 // This flag is the true test -- if true, the object is being acted on in the physical world
145 public abstract bool IsPhysicallyActive { get; }
146
142 // Materialness 147 // Materialness
143 public MaterialAttributes.Material Material { get; private set; } 148 public MaterialAttributes.Material Material { get; private set; }
144 public override void SetMaterial(int material) 149 public override void SetMaterial(int material)
@@ -302,8 +307,9 @@ public abstract class BSPhysObject : PhysicsActor
302 public virtual bool SendCollisions() 307 public virtual bool SendCollisions()
303 { 308 {
304 bool ret = true; 309 bool ret = true;
310
305 // If the 'no collision' call, force it to happen right now so quick collision_end 311 // If the 'no collision' call, force it to happen right now so quick collision_end
306 bool force = (CollisionCollection.Count == 0); 312 bool force = (CollisionCollection.Count == 0 && CollisionsLastTick.Count != 0);
307 313
308 // throttle the collisions to the number of milliseconds specified in the subscription 314 // throttle the collisions to the number of milliseconds specified in the subscription
309 if (force || (PhysicsScene.SimulationNowTime >= NextCollisionOkTime)) 315 if (force || (PhysicsScene.SimulationNowTime >= NextCollisionOkTime))
@@ -318,7 +324,7 @@ public abstract class BSPhysObject : PhysicsActor
318 ret = false; 324 ret = false;
319 } 325 }
320 326
321 // DetailLog("{0},{1}.SendCollisionUpdate,call,numCollisions={2}", LocalID, TypeName, CollisionCollection.Count); 327 DetailLog("{0},{1}.SendCollisionUpdate,call,numCollisions={2}", LocalID, TypeName, CollisionCollection.Count);
322 base.SendCollisionUpdate(CollisionCollection); 328 base.SendCollisionUpdate(CollisionCollection);
323 329
324 // Remember the collisions from this tick for some collision specific processing. 330 // Remember the collisions from this tick for some collision specific processing.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 79fe632..7aa2d92 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -132,8 +132,8 @@ public sealed class BSPrim : BSPhysObject
132 base.Destroy(); 132 base.Destroy();
133 133
134 // Undo any links between me and any other object 134 // Undo any links between me and any other object
135 BSPhysObject parentBefore = Linkset.LinksetRoot; 135 BSPhysObject parentBefore = Linkset.LinksetRoot; // DEBUG DEBUG
136 int childrenBefore = Linkset.NumberOfChildren; 136 int childrenBefore = Linkset.NumberOfChildren; // DEBUG DEBUG
137 137
138 Linkset = Linkset.RemoveMeFromLinkset(this); 138 Linkset = Linkset.RemoveMeFromLinkset(this);
139 139
@@ -727,6 +727,12 @@ public sealed class BSPrim : BSPhysObject
727 get { return !IsPhantom && !_isVolumeDetect; } 727 get { return !IsPhantom && !_isVolumeDetect; }
728 } 728 }
729 729
730 // The object is moving and is actively being dynamic in the physical world
731 public override bool IsPhysicallyActive
732 {
733 get { return !_isSelected && IsPhysical; }
734 }
735
730 // Make gravity work if the object is physical and not selected 736 // Make gravity work if the object is physical and not selected
731 // Called at taint-time!! 737 // Called at taint-time!!
732 private void SetObjectDynamic(bool forceRebuild) 738 private void SetObjectDynamic(bool forceRebuild)
@@ -1174,18 +1180,11 @@ public sealed class BSPrim : BSPhysObject
1174 // This added force will only last the next simulation tick. 1180 // This added force will only last the next simulation tick.
1175 public void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { 1181 public void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) {
1176 // for an object, doesn't matter if force is a pushforce or not 1182 // for an object, doesn't matter if force is a pushforce or not
1177 if (!IsStatic) 1183 if (IsPhysicallyActive)
1178 { 1184 {
1179 if (force.IsFinite()) 1185 if (force.IsFinite())
1180 { 1186 {
1181 float magnitude = force.Length(); 1187 OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude);
1182 if (magnitude > BSParam.MaxAddForceMagnitude)
1183 {
1184 // Force has a limit
1185 force = force / magnitude * BSParam.MaxAddForceMagnitude;
1186 }
1187
1188 OMV.Vector3 addForce = force;
1189 // DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce); 1188 // DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce);
1190 1189
1191 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate() 1190 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate()
@@ -1209,19 +1208,13 @@ public sealed class BSPrim : BSPhysObject
1209 1208
1210 public void AddForceImpulse(OMV.Vector3 impulse, bool pushforce, bool inTaintTime) { 1209 public void AddForceImpulse(OMV.Vector3 impulse, bool pushforce, bool inTaintTime) {
1211 // for an object, doesn't matter if force is a pushforce or not 1210 // for an object, doesn't matter if force is a pushforce or not
1212 if (!IsStatic) 1211 if (!IsPhysicallyActive)
1213 { 1212 {
1214 if (impulse.IsFinite()) 1213 if (impulse.IsFinite())
1215 { 1214 {
1216 float magnitude = impulse.Length(); 1215 OMV.Vector3 addImpulse = Util.ClampV(impulse, BSParam.MaxAddForceMagnitude);
1217 if (magnitude > BSParam.MaxAddForceMagnitude)
1218 {
1219 // Force has a limit
1220 impulse = impulse / magnitude * BSParam.MaxAddForceMagnitude;
1221 }
1222
1223 // DetailLog("{0},BSPrim.addForceImpulse,call,impulse={1}", LocalID, impulse); 1216 // DetailLog("{0},BSPrim.addForceImpulse,call,impulse={1}", LocalID, impulse);
1224 OMV.Vector3 addImpulse = impulse; 1217
1225 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddImpulse", delegate() 1218 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddImpulse", delegate()
1226 { 1219 {
1227 // Bullet adds this impulse immediately to the velocity 1220 // Bullet adds this impulse immediately to the velocity
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
index d4545f7..9bfec19 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
@@ -16,6 +16,7 @@ vehicle angular banking
16Avatars walking up stairs (HALF DONE) 16Avatars walking up stairs (HALF DONE)
17 Radius of the capsule affects ability to climb edges. 17 Radius of the capsule affects ability to climb edges.
18Vehicle movement on terrain smoothness 18Vehicle movement on terrain smoothness
19When is force introduced by SetForce removed? The prestep action could go forever.
19Boats float low in the water (DONE) 20Boats float low in the water (DONE)
20Avatar movement 21Avatar movement
21 flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle (DONE) 22 flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle (DONE)
@@ -72,8 +73,11 @@ Incorporate inter-relationship of angular corrections. For instance, angularDefl
72 73
73GENERAL TODO LIST: 74GENERAL TODO LIST:
74================================================= 75=================================================
76Implement llSetPhysicalMaterial.
77Implement llSetForceAndTorque.
75Implement an avatar mesh shape. The Bullet capsule is way too limited. 78Implement an avatar mesh shape. The Bullet capsule is way too limited.
76 Consider just hand creating a vertex/index array in a new BSShapeAvatar. 79 Consider just hand creating a vertex/index array in a new BSShapeAvatar.
80Verify/fix phantom, volume-detect objects do not fall to infinity. Should stop at terrain.
77Revisit CollisionMargin. Builders notice the 0.04 spacing between prims. 81Revisit CollisionMargin. Builders notice the 0.04 spacing between prims.
78Duplicating a physical prim causes old prim to jump away 82Duplicating a physical prim causes old prim to jump away
79 Dup a phys prim and the original become unselected and thus interacts w/ selected prim. 83 Dup a phys prim and the original become unselected and thus interacts w/ selected prim.
@@ -121,7 +125,7 @@ Physical and phantom will drop through the terrain
121LINKSETS 125LINKSETS
122====================================================== 126======================================================
123Editing a child of a linkset causes the child to go phantom 127Editing a child of a linkset causes the child to go phantom
124 Move a child prim once when it is physical and can never move it again without it going phantom 128 Move a child prim once when it is physical and can never move it again without it going phantom
125Offset the center of the linkset to be the geometric center of all the prims 129Offset the center of the linkset to be the geometric center of all the prims
126 Not quite the same as the center-of-gravity 130 Not quite the same as the center-of-gravity
127Linksets should allow collisions to individual children 131Linksets should allow collisions to individual children