aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-12-13 01:12:12 +0000
committerJustin Clark-Casey (justincc)2012-12-13 01:12:12 +0000
commit8e8da20af2bf011098ebf68aae80d92da56dae65 (patch)
treeff368505aa31f0df0fe83d9990ad3c08abb5e02e
parentFix sounds so that they play from inventory after teleport rather than only o... (diff)
parentBulletSim: fix problem of avatar's floating off the ground after unsitting. R... (diff)
downloadopensim-SC_OLD-8e8da20af2bf011098ebf68aae80d92da56dae65.zip
opensim-SC_OLD-8e8da20af2bf011098ebf68aae80d92da56dae65.tar.gz
opensim-SC_OLD-8e8da20af2bf011098ebf68aae80d92da56dae65.tar.bz2
opensim-SC_OLD-8e8da20af2bf011098ebf68aae80d92da56dae65.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs18
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs81
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs8
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs1
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs23
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt47
7 files changed, 109 insertions, 71 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 83c78f6..c8aad8d 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -105,12 +105,12 @@ public sealed class BSCharacter : BSPhysObject
105 DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5}", 105 DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5}",
106 LocalID, _size, Scale, _avatarDensity, _avatarVolume, RawMass); 106 LocalID, _size, Scale, _avatarDensity, _avatarVolume, RawMass);
107 107
108 // do actual create at taint time 108 // do actual creation in taint time
109 PhysicsScene.TaintedObject("BSCharacter.create", delegate() 109 PhysicsScene.TaintedObject("BSCharacter.create", delegate()
110 { 110 {
111 DetailLog("{0},BSCharacter.create,taint", LocalID); 111 DetailLog("{0},BSCharacter.create,taint", LocalID);
112 // New body and shape into PhysBody and PhysShape 112 // New body and shape into PhysBody and PhysShape
113 PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this, null, null); 113 PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this);
114 114
115 SetPhysicalProperties(); 115 SetPhysicalProperties();
116 }); 116 });
@@ -189,6 +189,11 @@ public sealed class BSCharacter : BSPhysObject
189 set { 189 set {
190 // When an avatar's size is set, only the height is changed. 190 // When an avatar's size is set, only the height is changed.
191 _size = value; 191 _size = value;
192 // Old versions of ScenePresence passed only the height. If width and/or depth are zero,
193 // replace with the default values.
194 if (_size.X == 0f) _size.X = PhysicsScene.Params.avatarCapsuleDepth;
195 if (_size.Y == 0f) _size.Y = PhysicsScene.Params.avatarCapsuleWidth;
196
192 ComputeAvatarScale(_size); 197 ComputeAvatarScale(_size);
193 ComputeAvatarVolumeAndMass(); 198 ComputeAvatarVolumeAndMass();
194 DetailLog("{0},BSCharacter.setSize,call,size={1},scale={2},density={3},volume={4},mass={5}", 199 DetailLog("{0},BSCharacter.setSize,call,size={1},scale={2},density={3},volume={4},mass={5}",
@@ -196,18 +201,18 @@ public sealed class BSCharacter : BSPhysObject
196 201
197 PhysicsScene.TaintedObject("BSCharacter.setSize", delegate() 202 PhysicsScene.TaintedObject("BSCharacter.setSize", delegate()
198 { 203 {
199 if (PhysShape.HasPhysicalShape) 204 if (PhysBody.HasPhysicalBody && PhysShape.HasPhysicalShape)
200 { 205 {
201 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale); 206 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale);
202 UpdatePhysicalMassProperties(RawMass); 207 UpdatePhysicalMassProperties(RawMass);
208 // Make sure this change appears as a property update event
209 BulletSimAPI.PushUpdate2(PhysBody.ptr);
203 } 210 }
204 }); 211 });
205 212
206 } 213 }
207 } 214 }
208 215
209 public override OMV.Vector3 Scale { get; set; }
210
211 public override PrimitiveBaseShape Shape 216 public override PrimitiveBaseShape Shape
212 { 217 {
213 set { BaseShape = value; } 218 set { BaseShape = value; }
@@ -638,9 +643,6 @@ public sealed class BSCharacter : BSPhysObject
638 643
639 private void ComputeAvatarScale(OMV.Vector3 size) 644 private void ComputeAvatarScale(OMV.Vector3 size)
640 { 645 {
641 // The 'size' given by the simulator is the mid-point of the avatar
642 // and X and Y are unspecified.
643
644 OMV.Vector3 newScale = size; 646 OMV.Vector3 newScale = size;
645 // newScale.X = PhysicsScene.Params.avatarCapsuleWidth; 647 // newScale.X = PhysicsScene.Params.avatarCapsuleWidth;
646 // newScale.Y = PhysicsScene.Params.avatarCapsuleDepth; 648 // newScale.Y = PhysicsScene.Params.avatarCapsuleDepth;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs b/OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs
index 390c2f9..c113a43 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs
@@ -50,10 +50,11 @@ public struct MaterialAttributes
50 Avatar, 50 Avatar,
51 NumberOfTypes // the count of types in the enum. 51 NumberOfTypes // the count of types in the enum.
52 } 52 }
53
53 // Names must be in the order of the above enum. 54 // Names must be in the order of the above enum.
54 public static string[] MaterialNames = { "Stone", "Metal", "Glass", "Wood", 55 // These names must coorespond to the lower case field names in the MaterialAttributes
55 "Flesh", "Plastic", "Rubber", "Light", "Avatar" }; 56 // structure as reflection is used to select the field to put the value in.
56 public static string[] MaterialAttribs = { "Density", "Friction", "Restitution"}; 57 public static readonly string[] MaterialAttribs = { "Density", "Friction", "Restitution"};
57 58
58 public MaterialAttributes(string t, float d, float f, float r) 59 public MaterialAttributes(string t, float d, float f, float r)
59 { 60 {
@@ -70,60 +71,74 @@ public struct MaterialAttributes
70 71
71public static class BSMaterials 72public static class BSMaterials
72{ 73{
73 public static MaterialAttributes[] Attributes; 74 // Attributes for each material type
75 private static readonly MaterialAttributes[] Attributes;
76
77 // Map of material name to material type code
78 public static readonly Dictionary<string, MaterialAttributes.Material> MaterialMap;
74 79
75 static BSMaterials() 80 static BSMaterials()
76 { 81 {
77 // Attribute sets for both the non-physical and physical instances of materials. 82 // Attribute sets for both the non-physical and physical instances of materials.
78 Attributes = new MaterialAttributes[(int)MaterialAttributes.Material.NumberOfTypes * 2]; 83 Attributes = new MaterialAttributes[(int)MaterialAttributes.Material.NumberOfTypes * 2];
84
85 // Map of name to type code.
86 MaterialMap = new Dictionary<string, MaterialAttributes.Material>();
87 MaterialMap.Add("Stone", MaterialAttributes.Material.Stone);
88 MaterialMap.Add("Metal", MaterialAttributes.Material.Metal);
89 MaterialMap.Add("Glass", MaterialAttributes.Material.Glass);
90 MaterialMap.Add("Wood", MaterialAttributes.Material.Wood);
91 MaterialMap.Add("Flesh", MaterialAttributes.Material.Flesh);
92 MaterialMap.Add("Plastic", MaterialAttributes.Material.Plastic);
93 MaterialMap.Add("Rubber", MaterialAttributes.Material.Rubber);
94 MaterialMap.Add("Light", MaterialAttributes.Material.Light);
95 MaterialMap.Add("Avatar", MaterialAttributes.Material.Avatar);
79 } 96 }
80 97
81 // This is where all the default material attributes are defined. 98 // This is where all the default material attributes are defined.
82 public static void InitializeFromDefaults(ConfigurationParameters parms) 99 public static void InitializeFromDefaults(ConfigurationParameters parms)
83 { 100 {
84 // Values from http://wiki.secondlife.com/wiki/PRIM_MATERIAL 101 // Values from http://wiki.secondlife.com/wiki/PRIM_MATERIAL
85 // public static string[] MaterialNames = { "Stone", "Metal", "Glass", "Wood", 102 float dDensity = parms.defaultDensity;
86 // "Flesh", "Plastic", "Rubber", "Light", "Avatar" };
87 float dFriction = parms.defaultFriction; 103 float dFriction = parms.defaultFriction;
88 float dRestitution = parms.defaultRestitution; 104 float dRestitution = parms.defaultRestitution;
89 float dDensity = parms.defaultDensity;
90 Attributes[(int)MaterialAttributes.Material.Stone] = 105 Attributes[(int)MaterialAttributes.Material.Stone] =
91 new MaterialAttributes("stone",dDensity, 0.8f, 0.4f); 106 new MaterialAttributes("stone",dDensity, 0.8f, 0.4f);
92 Attributes[(int)MaterialAttributes.Material.Metal] = 107 Attributes[(int)MaterialAttributes.Material.Metal] =
93 new MaterialAttributes("metal",dDensity, 0.3f, 0.4f); 108 new MaterialAttributes("metal",dDensity, 0.3f, 0.4f);
94 Attributes[(int)MaterialAttributes.Material.Glass] = 109 Attributes[(int)MaterialAttributes.Material.Glass] =
95 new MaterialAttributes("glass",dDensity, 0.2f, 0.7f); 110 new MaterialAttributes("glass",dDensity, 0.2f, 0.7f);
96 Attributes[(int)MaterialAttributes.Material.Wood] = 111 Attributes[(int)MaterialAttributes.Material.Wood] =
97 new MaterialAttributes("wood",dDensity, 0.6f, 0.5f); 112 new MaterialAttributes("wood",dDensity, 0.6f, 0.5f);
98 Attributes[(int)MaterialAttributes.Material.Flesh] = 113 Attributes[(int)MaterialAttributes.Material.Flesh] =
99 new MaterialAttributes("flesh",dDensity, 0.9f, 0.3f); 114 new MaterialAttributes("flesh",dDensity, 0.9f, 0.3f);
100 Attributes[(int)MaterialAttributes.Material.Plastic] = 115 Attributes[(int)MaterialAttributes.Material.Plastic] =
101 new MaterialAttributes("plastic",dDensity, 0.4f, 0.7f); 116 new MaterialAttributes("plastic",dDensity, 0.4f, 0.7f);
102 Attributes[(int)MaterialAttributes.Material.Rubber] = 117 Attributes[(int)MaterialAttributes.Material.Rubber] =
103 new MaterialAttributes("rubber",dDensity, 0.9f, 0.9f); 118 new MaterialAttributes("rubber",dDensity, 0.9f, 0.9f);
104 Attributes[(int)MaterialAttributes.Material.Light] = 119 Attributes[(int)MaterialAttributes.Material.Light] =
105 new MaterialAttributes("light",dDensity, dFriction, dRestitution); 120 new MaterialAttributes("light",dDensity, dFriction, dRestitution);
106 Attributes[(int)MaterialAttributes.Material.Avatar] = 121 Attributes[(int)MaterialAttributes.Material.Avatar] =
107 new MaterialAttributes("avatar",60f, 0.2f, 0f); 122 new MaterialAttributes("avatar",60f, 0.2f, 0f);
108 123
109 Attributes[(int)MaterialAttributes.Material.Stone + (int)MaterialAttributes.Material.NumberOfTypes] = 124 Attributes[(int)MaterialAttributes.Material.Stone + (int)MaterialAttributes.Material.NumberOfTypes] =
110 new MaterialAttributes("stonePhysical",dDensity, 0.8f, 0.4f); 125 new MaterialAttributes("stonePhysical",dDensity, 0.8f, 0.4f);
111 Attributes[(int)MaterialAttributes.Material.Metal + (int)MaterialAttributes.Material.NumberOfTypes] = 126 Attributes[(int)MaterialAttributes.Material.Metal + (int)MaterialAttributes.Material.NumberOfTypes] =
112 new MaterialAttributes("metalPhysical",dDensity, 0.8f, 0.4f); 127 new MaterialAttributes("metalPhysical",dDensity, 0.8f, 0.4f);
113 Attributes[(int)MaterialAttributes.Material.Glass + (int)MaterialAttributes.Material.NumberOfTypes] = 128 Attributes[(int)MaterialAttributes.Material.Glass + (int)MaterialAttributes.Material.NumberOfTypes] =
114 new MaterialAttributes("glassPhysical",dDensity, 0.8f, 0.7f); 129 new MaterialAttributes("glassPhysical",dDensity, 0.8f, 0.7f);
115 Attributes[(int)MaterialAttributes.Material.Wood + (int)MaterialAttributes.Material.NumberOfTypes] = 130 Attributes[(int)MaterialAttributes.Material.Wood + (int)MaterialAttributes.Material.NumberOfTypes] =
116 new MaterialAttributes("woodPhysical",dDensity, 0.8f, 0.5f); 131 new MaterialAttributes("woodPhysical",dDensity, 0.8f, 0.5f);
117 Attributes[(int)MaterialAttributes.Material.Flesh + (int)MaterialAttributes.Material.NumberOfTypes] = 132 Attributes[(int)MaterialAttributes.Material.Flesh + (int)MaterialAttributes.Material.NumberOfTypes] =
118 new MaterialAttributes("fleshPhysical",dDensity, 0.8f, 0.3f); 133 new MaterialAttributes("fleshPhysical",dDensity, 0.8f, 0.3f);
119 Attributes[(int)MaterialAttributes.Material.Plastic + (int)MaterialAttributes.Material.NumberOfTypes] = 134 Attributes[(int)MaterialAttributes.Material.Plastic + (int)MaterialAttributes.Material.NumberOfTypes] =
120 new MaterialAttributes("plasticPhysical",dDensity, 0.8f, 0.7f); 135 new MaterialAttributes("plasticPhysical",dDensity, 0.8f, 0.7f);
121 Attributes[(int)MaterialAttributes.Material.Rubber + (int)MaterialAttributes.Material.NumberOfTypes] = 136 Attributes[(int)MaterialAttributes.Material.Rubber + (int)MaterialAttributes.Material.NumberOfTypes] =
122 new MaterialAttributes("rubberPhysical",dDensity, 0.8f, 0.9f); 137 new MaterialAttributes("rubberPhysical",dDensity, 0.8f, 0.9f);
123 Attributes[(int)MaterialAttributes.Material.Light + (int)MaterialAttributes.Material.NumberOfTypes] = 138 Attributes[(int)MaterialAttributes.Material.Light + (int)MaterialAttributes.Material.NumberOfTypes] =
124 new MaterialAttributes("lightPhysical",dDensity, dFriction, dRestitution); 139 new MaterialAttributes("lightPhysical",dDensity, dFriction, dRestitution);
125 Attributes[(int)MaterialAttributes.Material.Avatar + (int)MaterialAttributes.Material.NumberOfTypes] = 140 Attributes[(int)MaterialAttributes.Material.Avatar + (int)MaterialAttributes.Material.NumberOfTypes] =
126 new MaterialAttributes("avatarPhysical",60f, 0.2f, 0f); 141 new MaterialAttributes("avatarPhysical",60f, 0.2f, 0f);
127 } 142 }
128 143
129 // Under the [BulletSim] section, one can change the individual material 144 // Under the [BulletSim] section, one can change the individual material
@@ -139,34 +154,34 @@ public static class BSMaterials
139 // the physical value. 154 // the physical value.
140 public static void InitializefromParameters(IConfig pConfig) 155 public static void InitializefromParameters(IConfig pConfig)
141 { 156 {
142 int matType = 0; 157 foreach (KeyValuePair<string, MaterialAttributes.Material> kvp in MaterialMap)
143 foreach (string matName in MaterialAttributes.MaterialNames)
144 { 158 {
159 string matName = kvp.Key;
145 foreach (string attribName in MaterialAttributes.MaterialAttribs) 160 foreach (string attribName in MaterialAttributes.MaterialAttribs)
146 { 161 {
147 string paramName = matName + attribName; 162 string paramName = matName + attribName;
148 if (pConfig.Contains(paramName)) 163 if (pConfig.Contains(paramName))
149 { 164 {
150 float paramValue = pConfig.GetFloat(paramName); 165 float paramValue = pConfig.GetFloat(paramName);
151 SetAttributeValue(matType, attribName, paramValue); 166 SetAttributeValue((int)kvp.Value, attribName, paramValue);
152 // set the physical value also 167 // set the physical value also
153 SetAttributeValue(matType + (int)MaterialAttributes.Material.NumberOfTypes, attribName, paramValue); 168 SetAttributeValue((int)kvp.Value + (int)MaterialAttributes.Material.NumberOfTypes, attribName, paramValue);
154 } 169 }
155 paramName += "Physical"; 170 paramName += "Physical";
156 if (pConfig.Contains(paramName)) 171 if (pConfig.Contains(paramName))
157 { 172 {
158 float paramValue = pConfig.GetFloat(paramName); 173 float paramValue = pConfig.GetFloat(paramName);
159 SetAttributeValue(matType + (int)MaterialAttributes.Material.NumberOfTypes, attribName, paramValue); 174 SetAttributeValue((int)kvp.Value + (int)MaterialAttributes.Material.NumberOfTypes, attribName, paramValue);
160 } 175 }
161 } 176 }
162 matType++;
163 } 177 }
164 } 178 }
165 179
180 // Use reflection to set the value in the attribute structure.
166 private static void SetAttributeValue(int matType, string attribName, float val) 181 private static void SetAttributeValue(int matType, string attribName, float val)
167 { 182 {
168 MaterialAttributes thisAttrib = Attributes[matType]; 183 MaterialAttributes thisAttrib = Attributes[matType];
169 FieldInfo fieldInfo = thisAttrib.GetType().GetField(attribName); 184 FieldInfo fieldInfo = thisAttrib.GetType().GetField(attribName.ToLower());
170 if (fieldInfo != null) 185 if (fieldInfo != null)
171 { 186 {
172 fieldInfo.SetValue(thisAttrib, val); 187 fieldInfo.SetValue(thisAttrib, val);
@@ -174,12 +189,12 @@ public static class BSMaterials
174 } 189 }
175 } 190 }
176 191
192 // Given a material type, return a structure of attributes.
177 public static MaterialAttributes GetAttributes(MaterialAttributes.Material type, bool isPhysical) 193 public static MaterialAttributes GetAttributes(MaterialAttributes.Material type, bool isPhysical)
178 { 194 {
179 int ind = (int)type; 195 int ind = (int)type;
180 if (isPhysical) ind += (int)MaterialAttributes.Material.NumberOfTypes; 196 if (isPhysical) ind += (int)MaterialAttributes.Material.NumberOfTypes;
181 return Attributes[ind]; 197 return Attributes[ind];
182 } 198 }
183
184} 199}
185} 200}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index f3b6993..6539b43 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -109,7 +109,7 @@ public abstract class BSPhysObject : PhysicsActor
109 public EntityProperties CurrentEntityProperties { get; set; } 109 public EntityProperties CurrentEntityProperties { get; set; }
110 public EntityProperties LastEntityProperties { get; set; } 110 public EntityProperties LastEntityProperties { get; set; }
111 111
112 public abstract OMV.Vector3 Scale { get; set; } 112 public virtual OMV.Vector3 Scale { get; set; }
113 public abstract bool IsSolid { get; } 113 public abstract bool IsSolid { get; }
114 public abstract bool IsStatic { get; } 114 public abstract bool IsStatic { get; }
115 115
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 35d22c0..19c29cc 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -45,7 +45,6 @@ public sealed class BSPrim : BSPhysObject
45 private static readonly string LogHeader = "[BULLETS PRIM]"; 45 private static readonly string LogHeader = "[BULLETS PRIM]";
46 46
47 // _size is what the user passed. Scale is what we pass to the physics engine with the mesh. 47 // _size is what the user passed. Scale is what we pass to the physics engine with the mesh.
48 // Often Scale is unity because the meshmerizer will apply _size when creating the mesh.
49 private OMV.Vector3 _size; // the multiplier for each mesh dimension as passed by the user 48 private OMV.Vector3 _size; // the multiplier for each mesh dimension as passed by the user
50 49
51 private bool _grabbed; 50 private bool _grabbed;
@@ -93,7 +92,7 @@ public sealed class BSPrim : BSPhysObject
93 _physicsActorType = (int)ActorTypes.Prim; 92 _physicsActorType = (int)ActorTypes.Prim;
94 _position = pos; 93 _position = pos;
95 _size = size; 94 _size = size;
96 Scale = size; // the scale will be set by CreateGeom depending on object type 95 Scale = size; // prims are the size the user wants them to be (different for BSCharactes).
97 _orientation = rotation; 96 _orientation = rotation;
98 _buoyancy = 1f; 97 _buoyancy = 1f;
99 _velocity = OMV.Vector3.Zero; 98 _velocity = OMV.Vector3.Zero;
@@ -159,12 +158,10 @@ public sealed class BSPrim : BSPhysObject
159 // We presume the scale and size are the same. If scale must be changed for 158 // We presume the scale and size are the same. If scale must be changed for
160 // the physical shape, that is done when the geometry is built. 159 // the physical shape, that is done when the geometry is built.
161 _size = value; 160 _size = value;
161 Scale = _size;
162 ForceBodyShapeRebuild(false); 162 ForceBodyShapeRebuild(false);
163 } 163 }
164 } 164 }
165 // Scale is what we set in the physics engine. It is different than 'size' in that
166 // 'size' can be encorporated into the mesh. In that case, the scale is <1,1,1>.
167 public override OMV.Vector3 Scale { get; set; }
168 165
169 public override PrimitiveBaseShape Shape { 166 public override PrimitiveBaseShape Shape {
170 set { 167 set {
@@ -1369,7 +1366,6 @@ public sealed class BSPrim : BSPhysObject
1369 // Create the correct physical representation for this type of object. 1366 // Create the correct physical representation for this type of object.
1370 // Updates PhysBody and PhysShape with the new information. 1367 // Updates PhysBody and PhysShape with the new information.
1371 // Ignore 'forceRebuild'. This routine makes the right choices and changes of necessary. 1368 // Ignore 'forceRebuild'. This routine makes the right choices and changes of necessary.
1372 // Returns 'true' if either the body or the shape was changed.
1373 PhysicsScene.Shapes.GetBodyAndShape(false, PhysicsScene.World, this, null, delegate(BulletBody dBody) 1369 PhysicsScene.Shapes.GetBodyAndShape(false, PhysicsScene.World, this, null, delegate(BulletBody dBody)
1374 { 1370 {
1375 // Called if the current prim body is about to be destroyed. 1371 // Called if the current prim body is about to be destroyed.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index f4f2801..cf5bb57 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -309,6 +309,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
309 BSMaterials.InitializeFromDefaults(Params); 309 BSMaterials.InitializeFromDefaults(Params);
310 if (pConfig != null) 310 if (pConfig != null)
311 { 311 {
312 // Let the user add new and interesting material property values.
312 BSMaterials.InitializefromParameters(pConfig); 313 BSMaterials.InitializefromParameters(pConfig);
313 } 314 }
314 } 315 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index 4ab9a99..ea996ae 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -126,6 +126,11 @@ public sealed class BSShapeCollection : IDisposable
126 return ret; 126 return ret;
127 } 127 }
128 128
129 public bool GetBodyAndShape(bool forceRebuild, BulletSim sim, BSPhysObject prim)
130 {
131 return GetBodyAndShape(forceRebuild, sim, prim, null, null);
132 }
133
129 // Track another user of a body. 134 // Track another user of a body.
130 // We presume the caller has allocated the body. 135 // We presume the caller has allocated the body.
131 // Bodies only have one user so the body is just put into the world if not already there. 136 // Bodies only have one user so the body is just put into the world if not already there.
@@ -460,6 +465,11 @@ public sealed class BSShapeCollection : IDisposable
460 && pbs.PathScaleX == 100 && pbs.PathScaleY == 100 465 && pbs.PathScaleX == 100 && pbs.PathScaleY == 100
461 && pbs.PathShearX == 0 && pbs.PathShearY == 0) ) ) 466 && pbs.PathShearX == 0 && pbs.PathShearY == 0) ) )
462 { 467 {
468 // Get the scale of any existing shape so we can see if the new shape is same native type and same size.
469 OMV.Vector3 scaleOfExistingShape = OMV.Vector3.Zero;
470 if (prim.PhysShape.HasPhysicalShape)
471 scaleOfExistingShape = BulletSimAPI.GetLocalScaling2(prim.PhysShape.ptr);
472
463 if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,maybeNative,force={1},primScale={2},primSize={3},primShape={4}", 473 if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,maybeNative,force={1},primScale={2},primSize={3},primShape={4}",
464 prim.LocalID, forceRebuild, prim.Scale, prim.Size, prim.PhysShape.type); 474 prim.LocalID, forceRebuild, prim.Scale, prim.Size, prim.PhysShape.type);
465 475
@@ -469,7 +479,7 @@ public sealed class BSShapeCollection : IDisposable
469 { 479 {
470 haveShape = true; 480 haveShape = true;
471 if (forceRebuild 481 if (forceRebuild
472 || prim.Scale != prim.Size 482 || prim.Scale != scaleOfExistingShape
473 || prim.PhysShape.type != BSPhysicsShapeType.SHAPE_SPHERE 483 || prim.PhysShape.type != BSPhysicsShapeType.SHAPE_SPHERE
474 ) 484 )
475 { 485 {
@@ -483,7 +493,7 @@ public sealed class BSShapeCollection : IDisposable
483 { 493 {
484 haveShape = true; 494 haveShape = true;
485 if (forceRebuild 495 if (forceRebuild
486 || prim.Scale != prim.Size 496 || prim.Scale != scaleOfExistingShape
487 || prim.PhysShape.type != BSPhysicsShapeType.SHAPE_BOX 497 || prim.PhysShape.type != BSPhysicsShapeType.SHAPE_BOX
488 ) 498 )
489 { 499 {
@@ -542,7 +552,6 @@ public sealed class BSShapeCollection : IDisposable
542 prim.LocalID, newShape, prim.Scale); 552 prim.LocalID, newShape, prim.Scale);
543 553
544 // native shapes are scaled by Bullet 554 // native shapes are scaled by Bullet
545 prim.Scale = prim.Size;
546 prim.PhysShape = newShape; 555 prim.PhysShape = newShape;
547 return true; 556 return true;
548 } 557 }
@@ -555,8 +564,8 @@ public sealed class BSShapeCollection : IDisposable
555 ShapeData nativeShapeData = new ShapeData(); 564 ShapeData nativeShapeData = new ShapeData();
556 nativeShapeData.Type = shapeType; 565 nativeShapeData.Type = shapeType;
557 nativeShapeData.ID = prim.LocalID; 566 nativeShapeData.ID = prim.LocalID;
558 nativeShapeData.Scale = prim.Size; 567 nativeShapeData.Scale = prim.Scale;
559 nativeShapeData.Size = prim.Size; // unneeded, I think. 568 nativeShapeData.Size = prim.Scale; // unneeded, I think.
560 nativeShapeData.MeshKey = (ulong)shapeKey; 569 nativeShapeData.MeshKey = (ulong)shapeKey;
561 nativeShapeData.HullKey = (ulong)shapeKey; 570 nativeShapeData.HullKey = (ulong)shapeKey;
562 571
@@ -611,8 +620,6 @@ public sealed class BSShapeCollection : IDisposable
611 620
612 ReferenceShape(newShape); 621 ReferenceShape(newShape);
613 622
614 // meshes are already scaled by the meshmerizer
615 prim.Scale = new OMV.Vector3(1f, 1f, 1f);
616 prim.PhysShape = newShape; 623 prim.PhysShape = newShape;
617 624
618 return true; // 'true' means a new shape has been added to this prim 625 return true; // 'true' means a new shape has been added to this prim
@@ -683,8 +690,6 @@ public sealed class BSShapeCollection : IDisposable
683 690
684 ReferenceShape(newShape); 691 ReferenceShape(newShape);
685 692
686 // hulls are already scaled by the meshmerizer
687 prim.Scale = new OMV.Vector3(1f, 1f, 1f);
688 prim.PhysShape = newShape; 693 prim.PhysShape = newShape;
689 return true; // 'true' means a new shape has been added to this prim 694 return true; // 'true' means a new shape has been added to this prim
690 } 695 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
index 1c7b577..11c1387 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
@@ -20,6 +20,10 @@ Neb car jiggling left and right
20 Happens on terrain and any other mesh object. Flat cubes are much smoother. 20 Happens on terrain and any other mesh object. Flat cubes are much smoother.
21 This has been reduced but not eliminated. 21 This has been reduced but not eliminated.
22For limitMotorUp, use raycast down to find if vehicle is in the air. 22For limitMotorUp, use raycast down to find if vehicle is in the air.
23Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE.
24 Verify that angular motion specified around Z moves in the vehicle coordinates.
25Verify llGetVel() is returning a smooth and good value for vehicle movement.
26llGetVel() should return the root's velocity if requested in a child prim.
23Implement function efficiency for lineaar and angular motion. 27Implement function efficiency for lineaar and angular motion.
24Should vehicle angular/linear movement friction happen after all the components 28Should vehicle angular/linear movement friction happen after all the components
25 or does it only apply to the basic movement? 29 or does it only apply to the basic movement?
@@ -32,19 +36,14 @@ Border crossing with linked vehicle causes crash
32 36
33BULLETSIM TODO LIST: 37BULLETSIM TODO LIST:
34================================================= 38=================================================
35Avatar height off after unsitting (float off ground) 39Avatar height off after unsitting (floats off ground)
36 Editting appearance then moving restores. 40 Editting appearance then moving restores.
37 Must not be initializing height when recreating capsule after unsit. 41 Must not be initializing height when recreating capsule after unsit.
38Duplicating a physical prim causes old prim to jump away 42Duplicating a physical prim causes old prim to jump away
39 Dup a phys prim and the original become unselected and thus interacts w/ selected prim. 43 Dup a phys prim and the original become unselected and thus interacts w/ selected prim.
40Disable activity of passive linkset children.
41 Since the linkset is a compound object, the old prims are left lying
42 around and need to be phantomized so they don't collide, ...
43Scenes with hundred of thousands of static objects take a lot of physics CPU time. 44Scenes with hundred of thousands of static objects take a lot of physics CPU time.
44BSPrim.Force should set a continious force on the prim. The force should be 45BSPrim.Force should set a continious force on the prim. The force should be
45 applied each tick. Some limits? 46 applied each tick. Some limits?
46Linksets should allow collisions to individual children
47 Add LocalID to children shapes in LinksetCompound and create events for individuals
48Gun sending shooter flying. 47Gun sending shooter flying.
49Collision margin (gap between physical objects lying on each other) 48Collision margin (gap between physical objects lying on each other)
50Boundry checking (crashes related to crossing boundry) 49Boundry checking (crashes related to crossing boundry)
@@ -57,14 +56,34 @@ Small physical objects do not interact correctly
57 The chain will fall apart and pairs will dance around on ground 56 The chain will fall apart and pairs will dance around on ground
58 Chains of 1x1x.2 will stay connected but will dance. 57 Chains of 1x1x.2 will stay connected but will dance.
59 Chains above 2x2x.4 are move stable and get stablier as torui get larger. 58 Chains above 2x2x.4 are move stable and get stablier as torui get larger.
60Add material type linkage and input all the material property definitions.
61 Skeleton classes and table are in the sources but are not filled or used.
62Add PID motor for avatar movement (slow to stop, ...) 59Add PID motor for avatar movement (slow to stop, ...)
63setForce should set a constant force. Different than AddImpulse. 60setForce should set a constant force. Different than AddImpulse.
64Implement raycast. 61Implement raycast.
65Implement ShapeCollection.Dispose() 62Implement ShapeCollection.Dispose()
66Implement water as a plain so raycasting and collisions can happen with same. 63Implement water as a plain so raycasting and collisions can happen with same.
64Add osGetPhysicsEngineName() so scripters can tell whether BulletSim or ODE
65 Also osGetPhysicsEngineVerion() maybe.
66
67LINKSETS
68======================================================
69Linksets should allow collisions to individual children
70 Add LocalID to children shapes in LinksetCompound and create events for individuals
71Verify/think through scripts in children of linksets. What do they reference
72 and return when getting position, velocity, ...
73Confirm constraint linksets still work after making all the changes for compound linksets.
74Add 'changed' flag or similar to reduce the number of times a linkset is rebuilt.
75 For compound linksets, add ability to remove or reposition individual child shapes.
76Disable activity of passive linkset children.
77 Since the linkset is a compound object, the old prims are left lying
78 around and need to be phantomized so they don't collide, ...
79Speed up creation of large physical linksets
80 For instance, sitting in Neb's car (130 prims) takes several seconds to become physical
81Eliminate collisions between objects in a linkset. (LinksetConstraint)
82 Have UserPointer point to struct with localID and linksetID?
83 Objects in original linkset still collide with each other?
67 84
85MORE
86======================================================
68Find/remove avatar collision with ID=0. 87Find/remove avatar collision with ID=0.
69Test avatar walking up stairs. How does compare with SL. 88Test avatar walking up stairs. How does compare with SL.
70 Radius of the capsule affects ability to climb edges. 89 Radius of the capsule affects ability to climb edges.
@@ -73,8 +92,6 @@ Debounce avatar contact so legs don't keep folding up when standing.
73Implement LSL physics controls. Like STATUS_ROTATE_X. 92Implement LSL physics controls. Like STATUS_ROTATE_X.
74Add border extensions to terrain to help region crossings and objects leaving region. 93Add border extensions to terrain to help region crossings and objects leaving region.
75 94
76Speed up creation of large physical linksets
77 For instance, sitting in Neb's car (130 prims) takes several seconds to become physical
78Performance test with lots of avatars. Can BulletSim support a thousand? 95Performance test with lots of avatars. Can BulletSim support a thousand?
79Optimize collisions in C++: only send up to the object subscribed to collisions. 96Optimize collisions in C++: only send up to the object subscribed to collisions.
80 Use collision subscription and remove the collsion(A,B) and collision(B,A) 97 Use collision subscription and remove the collsion(A,B) and collision(B,A)
@@ -85,10 +102,6 @@ Avatar jump
85Performance measurement and changes to make quicker. 102Performance measurement and changes to make quicker.
86Implement detailed physics stats (GetStats()). 103Implement detailed physics stats (GetStats()).
87 104
88Eliminate collisions between objects in a linkset. (LinksetConstraint)
89 Have UserPointer point to struct with localID and linksetID?
90 Objects in original linkset still collide with each other?
91
92Measure performance improvement from hulls 105Measure performance improvement from hulls
93Test not using ghost objects for volume detect implementation. 106Test not using ghost objects for volume detect implementation.
94Performance of closures and delegates for taint processing 107Performance of closures and delegates for taint processing
@@ -101,6 +114,9 @@ Physics Arena central pyramid: why is one side permiable?
101 114
102INTERNAL IMPROVEMENT/CLEANUP 115INTERNAL IMPROVEMENT/CLEANUP
103================================================= 116=================================================
117Consider moving prim/character body and shape destruction in destroy()
118 to postTimeTime rather than protecting all the potential sets that
119 might have been queued up.
104Remove unused fields from ShapeData (not used in API2) 120Remove unused fields from ShapeData (not used in API2)
105Breakout code for mesh/hull/compound/native into separate BSShape* classes 121Breakout code for mesh/hull/compound/native into separate BSShape* classes
106 Standardize access to building and reference code. 122 Standardize access to building and reference code.
@@ -154,3 +170,6 @@ Package Bullet source mods for Bullet internal stats output
154 (Resolution: move code into WorldData.h rather than relying on patches) 170 (Resolution: move code into WorldData.h rather than relying on patches)
155Single prim vehicles don't seem to properly vehiclize. 171Single prim vehicles don't seem to properly vehiclize.
156 (Resolution: mass was not getting set properly for single prim linksets) 172 (Resolution: mass was not getting set properly for single prim linksets)
173Add material type linkage and input all the material property definitions.
174 Skeleton classes and table are in the sources but are not filled or used.
175 (Resolution: