aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-03-27 02:10:02 +0100
committerJustin Clark-Casey (justincc)2012-03-27 02:10:02 +0100
commit09c85a6a6c3f40688c16e646342de773f8891c56 (patch)
tree7261bf18a1ab1368c5759ba859a13782e47957e0
parentIn TerrainModule.cs, the command terrain save-tile is modified to remove an u... (diff)
parentBulletSim: make avatar animations update properly. (diff)
downloadopensim-SC_OLD-09c85a6a6c3f40688c16e646342de773f8891c56.zip
opensim-SC_OLD-09c85a6a6c3f40688c16e646342de773f8891c56.tar.gz
opensim-SC_OLD-09c85a6a6c3f40688c16e646342de773f8891c56.tar.bz2
opensim-SC_OLD-09c85a6a6c3f40688c16e646342de773f8891c56.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs11
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs95
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs41
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs4
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs35
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs133
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs19
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs254
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IMOD_Api.cs25
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/MOD_Stub.cs39
-rw-r--r--bin/OpenSimDefaults.ini13
-rwxr-xr-xbin/lib32/BulletSim.dllbin562176 -> 533504 bytes
-rwxr-xr-xbin/lib32/libBulletSim.sobin0 -> 619145 bytes
-rwxr-xr-xbin/lib64/BulletSim.dllbin768000 -> 686080 bytes
-rwxr-xr-xbin/lib64/libBulletSim.sobin0 -> 688866 bytes
15 files changed, 531 insertions, 138 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
index bb4c788..bfe1e8d 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
@@ -26,12 +26,12 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Reflection;
29using OpenMetaverse; 30using OpenMetaverse;
30 31
31namespace OpenSim.Region.Framework.Interfaces 32namespace OpenSim.Region.Framework.Interfaces
32{ 33{
33 public delegate void ScriptCommand(UUID script, string id, string module, string command, string k); 34 public delegate void ScriptCommand(UUID script, string id, string module, string command, string k);
34 public delegate object ScriptInvocation(UUID script, object[] parms);
35 35
36 /// <summary> 36 /// <summary>
37 /// Interface for communication between OpenSim modules and in-world scripts 37 /// Interface for communication between OpenSim modules and in-world scripts
@@ -46,14 +46,17 @@ namespace OpenSim.Region.Framework.Interfaces
46 /// </summary> 46 /// </summary>
47 event ScriptCommand OnScriptCommand; 47 event ScriptCommand OnScriptCommand;
48 48
49 void RegisterScriptInvocation(string name, ScriptInvocation fn, Type[] csig, Type rsig); 49 void RegisterScriptInvocation(object target, string method);
50 void RegisterScriptInvocation(object target, MethodInfo method);
51 void RegisterScriptInvocation(object target, string[] methods);
52 Delegate[] GetScriptInvocationList();
50 53
51 ScriptInvocation LookupScriptInvocation(string fname); 54 Delegate LookupScriptInvocation(string fname);
52 string LookupModInvocation(string fname); 55 string LookupModInvocation(string fname);
53 Type[] LookupTypeSignature(string fname); 56 Type[] LookupTypeSignature(string fname);
54 Type LookupReturnType(string fname); 57 Type LookupReturnType(string fname);
55 58
56 object InvokeOperation(UUID scriptId, string fname, params object[] parms); 59 object InvokeOperation(UUID hostId, UUID scriptId, string fname, params object[] parms);
57 60
58 /// <summary> 61 /// <summary>
59 /// Send a link_message event to an in-world script 62 /// Send a link_message event to an in-world script
diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
index a90362e..cab30de 100644
--- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
@@ -35,6 +35,8 @@ using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
36using Mono.Addins; 36using Mono.Addins;
37using OpenMetaverse; 37using OpenMetaverse;
38using System.Linq;
39using System.Linq.Expressions;
38 40
39namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms 41namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
40{ 42{
@@ -47,15 +49,15 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
47#region ScriptInvocation 49#region ScriptInvocation
48 protected class ScriptInvocationData 50 protected class ScriptInvocationData
49 { 51 {
50 public ScriptInvocation ScriptInvocationFn { get; private set; } 52 public Delegate ScriptInvocationDelegate { get; private set; }
51 public string FunctionName { get; private set; } 53 public string FunctionName { get; private set; }
52 public Type[] TypeSignature { get; private set; } 54 public Type[] TypeSignature { get; private set; }
53 public Type ReturnType { get; private set; } 55 public Type ReturnType { get; private set; }
54 56
55 public ScriptInvocationData(string fname, ScriptInvocation fn, Type[] callsig, Type returnsig) 57 public ScriptInvocationData(string fname, Delegate fn, Type[] callsig, Type returnsig)
56 { 58 {
57 FunctionName = fname; 59 FunctionName = fname;
58 ScriptInvocationFn = fn; 60 ScriptInvocationDelegate = fn;
59 TypeSignature = callsig; 61 TypeSignature = callsig;
60 ReturnType = returnsig; 62 ReturnType = returnsig;
61 } 63 }
@@ -126,14 +128,72 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
126 m_scriptModule.PostScriptEvent(script, "link_message", args); 128 m_scriptModule.PostScriptEvent(script, "link_message", args);
127 } 129 }
128 130
129 public void RegisterScriptInvocation(string fname, ScriptInvocation fcall, Type[] csig, Type rsig) 131 public void RegisterScriptInvocation(object target, string meth)
130 { 132 {
133 MethodInfo mi = target.GetType().GetMethod(meth,
134 BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
135 if (mi == null)
136 {
137 m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}",meth);
138 return;
139 }
140
141 RegisterScriptInvocation(target, mi);
142 }
143
144 public void RegisterScriptInvocation(object target, string[] meth)
145 {
146 foreach (string m in meth)
147 RegisterScriptInvocation(target, m);
148 }
149
150 public void RegisterScriptInvocation(object target, MethodInfo mi)
151 {
152 m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}", mi.Name, target.GetType().Name);
153
154 Type delegateType;
155 var typeArgs = mi.GetParameters()
156 .Select(p => p.ParameterType)
157 .ToList();
158
159 if (mi.ReturnType == typeof(void))
160 {
161 delegateType = Expression.GetActionType(typeArgs.ToArray());
162 }
163 else
164 {
165 typeArgs.Add(mi.ReturnType);
166 delegateType = Expression.GetFuncType(typeArgs.ToArray());
167 }
168
169 Delegate fcall = Delegate.CreateDelegate(delegateType, target, mi);
170
131 lock (m_scriptInvocation) 171 lock (m_scriptInvocation)
132 { 172 {
133 m_scriptInvocation[fname] = new ScriptInvocationData(fname,fcall,csig,rsig); 173 ParameterInfo[] parameters = fcall.Method.GetParameters ();
174 if (parameters.Length < 2) // Must have two UUID params
175 return;
176
177 // Hide the first two parameters
178 Type[] parmTypes = new Type[parameters.Length - 2];
179 for (int i = 2 ; i < parameters.Length ; i++)
180 parmTypes[i - 2] = parameters[i].ParameterType;
181 m_scriptInvocation[fcall.Method.Name] = new ScriptInvocationData(fcall.Method.Name, fcall, parmTypes, fcall.Method.ReturnType);
134 } 182 }
135 } 183 }
136 184
185 public Delegate[] GetScriptInvocationList()
186 {
187 List<Delegate> ret = new List<Delegate>();
188
189 lock (m_scriptInvocation)
190 {
191 foreach (ScriptInvocationData d in m_scriptInvocation.Values)
192 ret.Add(d.ScriptInvocationDelegate);
193 }
194 return ret.ToArray();
195 }
196
137 public string LookupModInvocation(string fname) 197 public string LookupModInvocation(string fname)
138 { 198 {
139 lock (m_scriptInvocation) 199 lock (m_scriptInvocation)
@@ -147,19 +207,29 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
147 return "modInvokeI"; 207 return "modInvokeI";
148 else if (sid.ReturnType == typeof(float)) 208 else if (sid.ReturnType == typeof(float))
149 return "modInvokeF"; 209 return "modInvokeF";
210 else if (sid.ReturnType == typeof(UUID))
211 return "modInvokeK";
212 else if (sid.ReturnType == typeof(OpenMetaverse.Vector3))
213 return "modInvokeV";
214 else if (sid.ReturnType == typeof(OpenMetaverse.Quaternion))
215 return "modInvokeR";
216 else if (sid.ReturnType == typeof(object[]))
217 return "modInvokeL";
218
219 m_log.WarnFormat("[MODULE COMMANDS] failed to find match for {0} with return type {1}",fname,sid.ReturnType.Name);
150 } 220 }
151 } 221 }
152 222
153 return null; 223 return null;
154 } 224 }
155 225
156 public ScriptInvocation LookupScriptInvocation(string fname) 226 public Delegate LookupScriptInvocation(string fname)
157 { 227 {
158 lock (m_scriptInvocation) 228 lock (m_scriptInvocation)
159 { 229 {
160 ScriptInvocationData sid; 230 ScriptInvocationData sid;
161 if (m_scriptInvocation.TryGetValue(fname,out sid)) 231 if (m_scriptInvocation.TryGetValue(fname,out sid))
162 return sid.ScriptInvocationFn; 232 return sid.ScriptInvocationDelegate;
163 } 233 }
164 234
165 return null; 235 return null;
@@ -189,10 +259,15 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
189 return null; 259 return null;
190 } 260 }
191 261
192 public object InvokeOperation(UUID scriptid, string fname, params object[] parms) 262 public object InvokeOperation(UUID hostid, UUID scriptid, string fname, params object[] parms)
193 { 263 {
194 ScriptInvocation fn = LookupScriptInvocation(fname); 264 List<object> olist = new List<object>();
195 return fn(scriptid,parms); 265 olist.Add(hostid);
266 olist.Add(scriptid);
267 foreach (object o in parms)
268 olist.Add(o);
269 Delegate fn = LookupScriptInvocation(fname);
270 return fn.DynamicInvoke(olist.ToArray());
196 } 271 }
197#endregion 272#endregion
198 273
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 0cab5d1..b08d5db 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -94,7 +94,7 @@ public class BSCharacter : PhysicsActor
94 _flying = isFlying; 94 _flying = isFlying;
95 _orientation = Quaternion.Identity; 95 _orientation = Quaternion.Identity;
96 _velocity = Vector3.Zero; 96 _velocity = Vector3.Zero;
97 _buoyancy = isFlying ? 1f : 0f; 97 _buoyancy = ComputeBuoyancyFromFlying(isFlying);
98 _scale = new Vector3(1f, 1f, 1f); 98 _scale = new Vector3(1f, 1f, 1f);
99 _density = _scene.Params.avatarDensity; 99 _density = _scene.Params.avatarDensity;
100 ComputeAvatarVolumeAndMass(); // set _avatarVolume and _mass based on capsule size, _density and _scale 100 ComputeAvatarVolumeAndMass(); // set _avatarVolume and _mass based on capsule size, _density and _scale
@@ -110,7 +110,7 @@ public class BSCharacter : PhysicsActor
110 shapeData.Buoyancy = _buoyancy; 110 shapeData.Buoyancy = _buoyancy;
111 shapeData.Static = ShapeData.numericFalse; 111 shapeData.Static = ShapeData.numericFalse;
112 shapeData.Friction = _scene.Params.avatarFriction; 112 shapeData.Friction = _scene.Params.avatarFriction;
113 shapeData.Restitution = _scene.Params.defaultRestitution; 113 shapeData.Restitution = _scene.Params.avatarRestitution;
114 114
115 // do actual create at taint time 115 // do actual create at taint time
116 _scene.TaintedObject(delegate() 116 _scene.TaintedObject(delegate()
@@ -260,13 +260,13 @@ public class BSCharacter : PhysicsActor
260 get { return _flying; } 260 get { return _flying; }
261 set { 261 set {
262 _flying = value; 262 _flying = value;
263 _scene.TaintedObject(delegate() 263 // simulate flying by changing the effect of gravity
264 { 264 this.Buoyancy = ComputeBuoyancyFromFlying(_flying);
265 // simulate flying by changing the effect of gravity
266 BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, LocalID, _flying ? 1f : 0f);
267 });
268 } 265 }
269 } 266 }
267 private float ComputeBuoyancyFromFlying(bool ifFlying) {
268 return ifFlying ? 1f : 0f;
269 }
270 public override bool 270 public override bool
271 SetAlwaysRun { 271 SetAlwaysRun {
272 get { return _setAlwaysRun; } 272 get { return _setAlwaysRun; }
@@ -299,6 +299,7 @@ public class BSCharacter : PhysicsActor
299 get { return _kinematic; } 299 get { return _kinematic; }
300 set { _kinematic = value; } 300 set { _kinematic = value; }
301 } 301 }
302 // neg=fall quickly, 0=1g, 1=0g, pos=float up
302 public override float Buoyancy { 303 public override float Buoyancy {
303 get { return _buoyancy; } 304 get { return _buoyancy; }
304 set { _buoyancy = value; 305 set { _buoyancy = value;
@@ -355,7 +356,7 @@ public class BSCharacter : PhysicsActor
355 } 356 }
356 else 357 else
357 { 358 {
358 m_log.WarnFormat("{0}: Got a NaN force applied to a Character", LogHeader); 359 m_log.ErrorFormat("{0}: Got a NaN force applied to a Character", LogHeader);
359 } 360 }
360 //m_lastUpdateSent = false; 361 //m_lastUpdateSent = false;
361 } 362 }
@@ -425,6 +426,8 @@ public class BSCharacter : PhysicsActor
425 } 426 }
426 } 427 }
427 428
429 // Called by the scene when a collision with this object is reported
430 CollisionEventUpdate collisionCollection = null;
428 public void Collide(uint collidingWith, ActorTypes type, Vector3 contactPoint, Vector3 contactNormal, float pentrationDepth) 431 public void Collide(uint collidingWith, ActorTypes type, Vector3 contactPoint, Vector3 contactNormal, float pentrationDepth)
429 { 432 {
430 // m_log.DebugFormat("{0}: Collide: ms={1}, id={2}, with={3}", LogHeader, _subscribedEventsMs, LocalID, collidingWith); 433 // m_log.DebugFormat("{0}: Collide: ms={1}, id={2}, with={3}", LogHeader, _subscribedEventsMs, LocalID, collidingWith);
@@ -442,10 +445,24 @@ public class BSCharacter : PhysicsActor
442 if (nowTime < (_lastCollisionTime + _subscribedEventsMs)) return; 445 if (nowTime < (_lastCollisionTime + _subscribedEventsMs)) return;
443 _lastCollisionTime = nowTime; 446 _lastCollisionTime = nowTime;
444 447
445 Dictionary<uint, ContactPoint> contactPoints = new Dictionary<uint, ContactPoint>(); 448 if (collisionCollection == null)
446 contactPoints.Add(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); 449 collisionCollection = new CollisionEventUpdate();
447 CollisionEventUpdate args = new CollisionEventUpdate(contactPoints); 450 collisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth));
448 base.SendCollisionUpdate(args); 451 }
452
453 public void SendCollisions()
454 {
455 // if (collisionCollection != null)
456 // {
457 // base.SendCollisionUpdate(collisionCollection);
458 // collisionCollection = null;
459 // }
460 // Kludge to make a collision call even if there are no collisions.
461 // This causes the avatar animation to get updated.
462 if (collisionCollection == null)
463 collisionCollection = new CollisionEventUpdate();
464 base.SendCollisionUpdate(collisionCollection);
465 collisionCollection = null;
449 } 466 }
450 467
451} 468}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 046726d..eb20eb3 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -821,7 +821,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
821 */ 821 */
822 822
823 // Get what the body is doing, this includes 'external' influences 823 // Get what the body is doing, this includes 'external' influences
824 Vector3 angularVelocity = m_prim.AngularVelocity; 824 Vector3 angularVelocity = m_prim.RotationalVelocity;
825 // Vector3 angularVelocity = Vector3.Zero; 825 // Vector3 angularVelocity = Vector3.Zero;
826 826
827 if (m_angularMotorApply > 0) 827 if (m_angularMotorApply > 0)
@@ -910,7 +910,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
910 m_lastAngularVelocity -= m_lastAngularVelocity * decayamount; 910 m_lastAngularVelocity -= m_lastAngularVelocity * decayamount;
911 911
912 // Apply to the body 912 // Apply to the body
913 m_prim.AngularVelocity = m_lastAngularVelocity; 913 m_prim.RotationalVelocity = m_lastAngularVelocity;
914 914
915 } //end MoveAngular 915 } //end MoveAngular
916 internal void LimitRotation(float timestep) 916 internal void LimitRotation(float timestep)
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 898436b..248d1f2 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -85,7 +85,6 @@ public sealed class BSPrim : PhysicsActor
85 private OMV.Vector3 _rotationalVelocity; 85 private OMV.Vector3 _rotationalVelocity;
86 private bool _kinematic; 86 private bool _kinematic;
87 private float _buoyancy; 87 private float _buoyancy;
88 private OMV.Vector3 _angularVelocity;
89 88
90 private List<BSPrim> _childrenPrims; 89 private List<BSPrim> _childrenPrims;
91 private BSPrim _parentPrim; 90 private BSPrim _parentPrim;
@@ -119,7 +118,6 @@ public sealed class BSPrim : PhysicsActor
119 _buoyancy = 1f; 118 _buoyancy = 1f;
120 _velocity = OMV.Vector3.Zero; 119 _velocity = OMV.Vector3.Zero;
121 _rotationalVelocity = OMV.Vector3.Zero; 120 _rotationalVelocity = OMV.Vector3.Zero;
122 _angularVelocity = OMV.Vector3.Zero;
123 _hullKey = 0; 121 _hullKey = 0;
124 _meshKey = 0; 122 _meshKey = 0;
125 _pbs = pbs; 123 _pbs = pbs;
@@ -146,7 +144,7 @@ public sealed class BSPrim : PhysicsActor
146 // called when this prim is being destroyed and we should free all the resources 144 // called when this prim is being destroyed and we should free all the resources
147 public void Destroy() 145 public void Destroy()
148 { 146 {
149 // m_log.DebugFormat("{0}: Destroy", LogHeader); 147 // m_log.DebugFormat("{0}: Destroy, id={1}", LogHeader, LocalID);
150 // Undo any vehicle properties 148 // Undo any vehicle properties
151 _vehicle.ProcessTypeChange(Vehicle.TYPE_NONE); 149 _vehicle.ProcessTypeChange(Vehicle.TYPE_NONE);
152 _scene.RemoveVehiclePrim(this); // just to make sure 150 _scene.RemoveVehiclePrim(this); // just to make sure
@@ -203,7 +201,7 @@ public sealed class BSPrim : PhysicsActor
203 201
204 // link me to the specified parent 202 // link me to the specified parent
205 public override void link(PhysicsActor obj) { 203 public override void link(PhysicsActor obj) {
206 BSPrim parent = (BSPrim)obj; 204 BSPrim parent = obj as BSPrim;
207 // m_log.DebugFormat("{0}: link {1}/{2} to {3}", LogHeader, _avName, _localID, obj.LocalID); 205 // m_log.DebugFormat("{0}: link {1}/{2} to {3}", LogHeader, _avName, _localID, obj.LocalID);
208 // TODO: decide if this parent checking needs to happen at taint time 206 // TODO: decide if this parent checking needs to happen at taint time
209 if (_parentPrim == null) 207 if (_parentPrim == null)
@@ -527,10 +525,6 @@ public sealed class BSPrim : PhysicsActor
527 }); 525 });
528 } 526 }
529 } 527 }
530 public OMV.Vector3 AngularVelocity {
531 get { return _angularVelocity; }
532 set { _angularVelocity = value; }
533 }
534 public override bool Kinematic { 528 public override bool Kinematic {
535 get { return _kinematic; } 529 get { return _kinematic; }
536 set { _kinematic = value; 530 set { _kinematic = value;
@@ -993,7 +987,7 @@ public sealed class BSPrim : PhysicsActor
993 } 987 }
994 988
995 // m_log.DebugFormat("{0}: CreateGeomMesh: calling CreateMesh. lid={1}, key={2}, indices={3}, vertices={4}", 989 // m_log.DebugFormat("{0}: CreateGeomMesh: calling CreateMesh. lid={1}, key={2}, indices={3}, vertices={4}",
996 // LogHeader, _localID, _meshKey, indices.Length, vertices.Count); 990 // LogHeader, _localID, _meshKey, indices.Length, vertices.Count);
997 BulletSimAPI.CreateMesh(_scene.WorldID, _meshKey, indices.GetLength(0), indices, 991 BulletSimAPI.CreateMesh(_scene.WorldID, _meshKey, indices.GetLength(0), indices,
998 vertices.Count, verticesAsFloats); 992 vertices.Count, verticesAsFloats);
999 993
@@ -1127,7 +1121,7 @@ public sealed class BSPrim : PhysicsActor
1127 return; 1121 return;
1128 } 1122 }
1129 1123
1130 // Create an object in Bullet 1124 // Create an object in Bullet if it has not already been created
1131 // No locking here because this is done when the physics engine is not simulating 1125 // No locking here because this is done when the physics engine is not simulating
1132 private void CreateObject() 1126 private void CreateObject()
1133 { 1127 {
@@ -1324,13 +1318,15 @@ public sealed class BSPrim : PhysicsActor
1324 _velocity = entprop.Velocity; 1318 _velocity = entprop.Velocity;
1325 _acceleration = entprop.Acceleration; 1319 _acceleration = entprop.Acceleration;
1326 _rotationalVelocity = entprop.RotationalVelocity; 1320 _rotationalVelocity = entprop.RotationalVelocity;
1327 // m_log.DebugFormat("{0}: RequestTerseUpdate. id={1}, ch={2}, pos={3}, rot={4}", LogHeader, LocalID, changed, _position, _orientation); 1321 // m_log.DebugFormat("{0}: RequestTerseUpdate. id={1}, ch={2}, pos={3}, rot={4}, vel={5}, acc={6}, rvel={7}",
1322 // LogHeader, LocalID, changed, _position, _orientation, _velocity, _acceleration, _rotationalVelocity);
1328 base.RequestPhysicsterseUpdate(); 1323 base.RequestPhysicsterseUpdate();
1329 } 1324 }
1330 } 1325 }
1331 } 1326 }
1332 1327
1333 // I've collided with something 1328 // I've collided with something
1329 CollisionEventUpdate collisionCollection = null;
1334 public void Collide(uint collidingWith, ActorTypes type, OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth) 1330 public void Collide(uint collidingWith, ActorTypes type, OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth)
1335 { 1331 {
1336 // m_log.DebugFormat("{0}: Collide: ms={1}, id={2}, with={3}", LogHeader, _subscribedEventsMs, LocalID, collidingWith); 1332 // m_log.DebugFormat("{0}: Collide: ms={1}, id={2}, with={3}", LogHeader, _subscribedEventsMs, LocalID, collidingWith);
@@ -1348,11 +1344,18 @@ public sealed class BSPrim : PhysicsActor
1348 if (nowTime < (_lastCollisionTime + _subscribedEventsMs)) return; 1344 if (nowTime < (_lastCollisionTime + _subscribedEventsMs)) return;
1349 _lastCollisionTime = nowTime; 1345 _lastCollisionTime = nowTime;
1350 1346
1351 // create the event for the collision 1347 if (collisionCollection == null)
1352 Dictionary<uint, ContactPoint> contactPoints = new Dictionary<uint, ContactPoint>(); 1348 collisionCollection = new CollisionEventUpdate();
1353 contactPoints.Add(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); 1349 collisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth));
1354 CollisionEventUpdate args = new CollisionEventUpdate(contactPoints); 1350 }
1355 base.SendCollisionUpdate(args); 1351
1352 public void SendCollisions()
1353 {
1354 if (collisionCollection != null)
1355 {
1356 base.SendCollisionUpdate(collisionCollection);
1357 collisionCollection = null;
1358 }
1356 } 1359 }
1357} 1360}
1358} 1361}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index e9a849c..94a0ccf 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -37,14 +37,18 @@ using OpenMetaverse;
37using OpenSim.Region.Framework; 37using OpenSim.Region.Framework;
38 38
39// TODOs for BulletSim (for BSScene, BSPrim, BSCharacter and BulletSim) 39// TODOs for BulletSim (for BSScene, BSPrim, BSCharacter and BulletSim)
40// Debug linkset
41// Test with multiple regions in one simulator
40// Adjust character capsule size when height is adjusted (ScenePresence.SetHeight) 42// Adjust character capsule size when height is adjusted (ScenePresence.SetHeight)
41// Test sculpties 43// Test sculpties
42// Compute physics FPS reasonably 44// Compute physics FPS reasonably
43// Based on material, set density and friction 45// Based on material, set density and friction
44// More efficient memory usage in passing hull information from BSPrim to BulletSim 46// More efficient memory usage when passing hull information from BSPrim to BulletSim
45// Four states of prim: Physical, regular, phantom and selected. Are we modeling these correctly? 47// Four states of prim: Physical, regular, phantom and selected. Are we modeling these correctly?
46// In SL one can set both physical and phantom (gravity, does not effect others, makes collisions with ground) 48// In SL one can set both physical and phantom (gravity, does not effect others, makes collisions with ground)
47// At the moment, physical and phantom causes object to drop through the terrain 49// At the moment, physical and phantom causes object to drop through the terrain
50// Physical phantom objects and related typing (collision options )
51// Check out llVolumeDetect. Must do something for that.
48// Should prim.link() and prim.delink() membership checking happen at taint time? 52// Should prim.link() and prim.delink() membership checking happen at taint time?
49// Mesh sharing. Use meshHash to tell if we already have a hull of that shape and only create once 53// Mesh sharing. Use meshHash to tell if we already have a hull of that shape and only create once
50// Do attachments need to be handled separately? Need collision events. Do not collide with VolumeDetect 54// Do attachments need to be handled separately? Need collision events. Do not collide with VolumeDetect
@@ -52,6 +56,16 @@ using OpenSim.Region.Framework;
52// Implement LockAngularMotion 56// Implement LockAngularMotion
53// Decide if clearing forces is the right thing to do when setting position (BulletSim::SetObjectTranslation) 57// Decide if clearing forces is the right thing to do when setting position (BulletSim::SetObjectTranslation)
54// Does NeedsMeshing() really need to exclude all the different shapes? 58// Does NeedsMeshing() really need to exclude all the different shapes?
59// Remove mesh and Hull stuff. Use mesh passed to bullet and use convexdecom from bullet.
60// Add PID movement operations. What does ScenePresence.MoveToTarget do?
61// Check terrain size. 128 or 127?
62// Multiple contact points on collision?
63// See code in ode::near... calls to collision_accounting_events()
64// (This might not be a problem. ODE collects all the collisions with one object in one tick.)
65// Use collision masks for collision with terrain and phantom objects
66// Figure out how to not allocate a new Dictionary and List for every collision
67// in BSPrim.Collide() and BSCharacter.Collide(). Can the same ones be reused?
68// Raycast
55// 69//
56namespace OpenSim.Region.Physics.BulletSPlugin 70namespace OpenSim.Region.Physics.BulletSPlugin
57{ 71{
@@ -64,6 +78,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters
64 78
65 private Dictionary<uint, BSCharacter> m_avatars = new Dictionary<uint, BSCharacter>(); 79 private Dictionary<uint, BSCharacter> m_avatars = new Dictionary<uint, BSCharacter>();
66 private Dictionary<uint, BSPrim> m_prims = new Dictionary<uint, BSPrim>(); 80 private Dictionary<uint, BSPrim> m_prims = new Dictionary<uint, BSPrim>();
81 private HashSet<BSCharacter> m_avatarsWithCollisions = new HashSet<BSCharacter>();
82 private HashSet<BSPrim> m_primsWithCollisions = new HashSet<BSPrim>();
67 private List<BSPrim> m_vehicles = new List<BSPrim>(); 83 private List<BSPrim> m_vehicles = new List<BSPrim>();
68 private float[] m_heightMap; 84 private float[] m_heightMap;
69 private float m_waterLevel; 85 private float m_waterLevel;
@@ -164,6 +180,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
164 if (m_log.IsDebugEnabled) 180 if (m_log.IsDebugEnabled)
165 { 181 {
166 m_log.DebugFormat("{0}: Initialize: Setting debug callback for unmanaged code", LogHeader); 182 m_log.DebugFormat("{0}: Initialize: Setting debug callback for unmanaged code", LogHeader);
183 // the handle is saved to it doesn't get freed after this call
167 m_DebugLogCallbackHandle = new BulletSimAPI.DebugLogCallback(BulletLogger); 184 m_DebugLogCallbackHandle = new BulletSimAPI.DebugLogCallback(BulletLogger);
168 BulletSimAPI.SetDebugLogCallback(m_DebugLogCallbackHandle); 185 BulletSimAPI.SetDebugLogCallback(m_DebugLogCallbackHandle);
169 } 186 }
@@ -172,7 +189,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
172 189
173 mesher = meshmerizer; 190 mesher = meshmerizer;
174 // The bounding box for the simulated world 191 // The bounding box for the simulated world
175 Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, 4096f); 192 Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, 8192f);
176 193
177 // m_log.DebugFormat("{0}: Initialize: Calling BulletSimAPI.Initialize.", LogHeader); 194 // m_log.DebugFormat("{0}: Initialize: Calling BulletSimAPI.Initialize.", LogHeader);
178 m_worldID = BulletSimAPI.Initialize(worldExtent, m_paramsHandle.AddrOfPinnedObject(), 195 m_worldID = BulletSimAPI.Initialize(worldExtent, m_paramsHandle.AddrOfPinnedObject(),
@@ -220,10 +237,20 @@ public class BSScene : PhysicsScene, IPhysicsParameters
220 parms.terrainFriction = 0.5f; 237 parms.terrainFriction = 0.5f;
221 parms.terrainHitFraction = 0.8f; 238 parms.terrainHitFraction = 0.8f;
222 parms.terrainRestitution = 0f; 239 parms.terrainRestitution = 0f;
223 parms.avatarFriction = 0.0f; 240 parms.avatarFriction = 0.5f;
241 parms.avatarRestitution = 0.0f;
224 parms.avatarDensity = 60f; 242 parms.avatarDensity = 60f;
225 parms.avatarCapsuleRadius = 0.37f; 243 parms.avatarCapsuleRadius = 0.37f;
226 parms.avatarCapsuleHeight = 1.5f; // 2.140599f 244 parms.avatarCapsuleHeight = 1.5f; // 2.140599f
245 parms.avatarContactProcessingThreshold = 0.1f;
246
247 parms.maxPersistantManifoldPoolSize = 0f;
248 parms.shouldDisableContactPoolDynamicAllocation = ConfigurationParameters.numericTrue;
249 parms.shouldForceUpdateAllAabbs = ConfigurationParameters.numericFalse;
250 parms.shouldRandomizeSolverOrder = ConfigurationParameters.numericFalse;
251 parms.shouldSplitSimulationIslands = ConfigurationParameters.numericFalse;
252 parms.shouldEnableFrictionCaching = ConfigurationParameters.numericFalse;
253 parms.numberOfSolverIterations = 0f; // means use default
227 254
228 if (config != null) 255 if (config != null)
229 { 256 {
@@ -265,14 +292,40 @@ public class BSScene : PhysicsScene, IPhysicsParameters
265 parms.terrainHitFraction = pConfig.GetFloat("TerrainHitFraction", parms.terrainHitFraction); 292 parms.terrainHitFraction = pConfig.GetFloat("TerrainHitFraction", parms.terrainHitFraction);
266 parms.terrainRestitution = pConfig.GetFloat("TerrainRestitution", parms.terrainRestitution); 293 parms.terrainRestitution = pConfig.GetFloat("TerrainRestitution", parms.terrainRestitution);
267 parms.avatarFriction = pConfig.GetFloat("AvatarFriction", parms.avatarFriction); 294 parms.avatarFriction = pConfig.GetFloat("AvatarFriction", parms.avatarFriction);
295 parms.avatarRestitution = pConfig.GetFloat("AvatarRestitution", parms.avatarRestitution);
268 parms.avatarDensity = pConfig.GetFloat("AvatarDensity", parms.avatarDensity); 296 parms.avatarDensity = pConfig.GetFloat("AvatarDensity", parms.avatarDensity);
269 parms.avatarCapsuleRadius = pConfig.GetFloat("AvatarCapsuleRadius", parms.avatarCapsuleRadius); 297 parms.avatarCapsuleRadius = pConfig.GetFloat("AvatarCapsuleRadius", parms.avatarCapsuleRadius);
270 parms.avatarCapsuleHeight = pConfig.GetFloat("AvatarCapsuleHeight", parms.avatarCapsuleHeight); 298 parms.avatarCapsuleHeight = pConfig.GetFloat("AvatarCapsuleHeight", parms.avatarCapsuleHeight);
299 parms.avatarContactProcessingThreshold = pConfig.GetFloat("AvatarContactProcessingThreshold", parms.avatarContactProcessingThreshold);
300
301 parms.maxPersistantManifoldPoolSize = pConfig.GetFloat("MaxPersistantManifoldPoolSize", parms.maxPersistantManifoldPoolSize);
302 parms.shouldDisableContactPoolDynamicAllocation = ParamBoolean(pConfig, "ShouldDisableContactPoolDynamicAllocation", parms.shouldDisableContactPoolDynamicAllocation);
303 parms.shouldForceUpdateAllAabbs = ParamBoolean(pConfig, "ShouldForceUpdateAllAabbs", parms.shouldForceUpdateAllAabbs);
304 parms.shouldRandomizeSolverOrder = ParamBoolean(pConfig, "ShouldRandomizeSolverOrder", parms.shouldRandomizeSolverOrder);
305 parms.shouldSplitSimulationIslands = ParamBoolean(pConfig, "ShouldSplitSimulationIslands", parms.shouldSplitSimulationIslands);
306 parms.shouldEnableFrictionCaching = ParamBoolean(pConfig, "ShouldEnableFrictionCaching", parms.shouldEnableFrictionCaching);
307 parms.numberOfSolverIterations = pConfig.GetFloat("NumberOfSolverIterations", parms.numberOfSolverIterations);
271 } 308 }
272 } 309 }
273 m_params[0] = parms; 310 m_params[0] = parms;
274 } 311 }
275 312
313 // A helper function that handles a true/false parameter and returns the proper float number encoding
314 float ParamBoolean(IConfig config, string parmName, float deflt)
315 {
316 float ret = deflt;
317 if (config.Contains(parmName))
318 {
319 ret = ConfigurationParameters.numericFalse;
320 if (config.GetBoolean(parmName, false))
321 {
322 ret = ConfigurationParameters.numericTrue;
323 }
324 }
325 return ret;
326 }
327
328
276 // Called directly from unmanaged code so don't do much 329 // Called directly from unmanaged code so don't do much
277 private void BulletLogger(string msg) 330 private void BulletLogger(string msg)
278 { 331 {
@@ -384,6 +437,17 @@ public class BSScene : PhysicsScene, IPhysicsParameters
384 } 437 }
385 } 438 }
386 439
440 // The SendCollision's batch up the collisions on the objects. Now push the collisions into the simulator.
441 foreach (BSPrim bsp in m_primsWithCollisions)
442 bsp.SendCollisions();
443 m_primsWithCollisions.Clear();
444 // foreach (BSCharacter bsc in m_avatarsWithCollisions)
445 // bsc.SendCollisions();
446 // This is a kludge to get avatar movement updated. ODE sends collisions even if there isn't any
447 foreach (KeyValuePair<uint, BSCharacter> kvp in m_avatars)
448 kvp.Value.SendCollisions();
449 m_avatarsWithCollisions.Clear();
450
387 // If any of the objects had updated properties, tell the object it has been changed by the physics engine 451 // If any of the objects had updated properties, tell the object it has been changed by the physics engine
388 if (updatedEntityCount > 0) 452 if (updatedEntityCount > 0)
389 { 453 {
@@ -391,16 +455,16 @@ public class BSScene : PhysicsScene, IPhysicsParameters
391 { 455 {
392 EntityProperties entprop = m_updateArray[ii]; 456 EntityProperties entprop = m_updateArray[ii];
393 // m_log.DebugFormat("{0}: entprop[{1}]: id={2}, pos={3}", LogHeader, ii, entprop.ID, entprop.Position); 457 // m_log.DebugFormat("{0}: entprop[{1}]: id={2}, pos={3}", LogHeader, ii, entprop.ID, entprop.Position);
394 BSCharacter actor;
395 if (m_avatars.TryGetValue(entprop.ID, out actor))
396 {
397 actor.UpdateProperties(entprop);
398 continue;
399 }
400 BSPrim prim; 458 BSPrim prim;
401 if (m_prims.TryGetValue(entprop.ID, out prim)) 459 if (m_prims.TryGetValue(entprop.ID, out prim))
402 { 460 {
403 prim.UpdateProperties(entprop); 461 prim.UpdateProperties(entprop);
462 continue;
463 }
464 BSCharacter actor;
465 if (m_avatars.TryGetValue(entprop.ID, out actor))
466 {
467 actor.UpdateProperties(entprop);
404 } 468 }
405 } 469 }
406 } 470 }
@@ -434,11 +498,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters
434 BSPrim prim; 498 BSPrim prim;
435 if (m_prims.TryGetValue(localID, out prim)) { 499 if (m_prims.TryGetValue(localID, out prim)) {
436 prim.Collide(collidingWith, type, collidePoint, collideNormal, penitration); 500 prim.Collide(collidingWith, type, collidePoint, collideNormal, penitration);
501 m_primsWithCollisions.Add(prim);
437 return; 502 return;
438 } 503 }
439 BSCharacter actor; 504 BSCharacter actor;
440 if (m_avatars.TryGetValue(localID, out actor)) { 505 if (m_avatars.TryGetValue(localID, out actor)) {
441 actor.Collide(collidingWith, type, collidePoint, collideNormal, penitration); 506 actor.Collide(collidingWith, type, collidePoint, collideNormal, penitration);
507 m_avatarsWithCollisions.Add(actor);
442 return; 508 return;
443 } 509 }
444 return; 510 return;
@@ -470,12 +536,12 @@ public class BSScene : PhysicsScene, IPhysicsParameters
470 536
471 public override void DeleteTerrain() 537 public override void DeleteTerrain()
472 { 538 {
473 m_log.DebugFormat("{0}: DeleteTerrain()", LogHeader); 539 // m_log.DebugFormat("{0}: DeleteTerrain()", LogHeader);
474 } 540 }
475 541
476 public override void Dispose() 542 public override void Dispose()
477 { 543 {
478 m_log.DebugFormat("{0}: Dispose()", LogHeader); 544 // m_log.DebugFormat("{0}: Dispose()", LogHeader);
479 } 545 }
480 546
481 public override Dictionary<uint, float> GetTopColliders() 547 public override Dictionary<uint, float> GetTopColliders()
@@ -699,9 +765,23 @@ public class BSScene : PhysicsScene, IPhysicsParameters
699 new PhysParameterEntry("DeactivationTime", "Seconds before considering an object potentially static" ), 765 new PhysParameterEntry("DeactivationTime", "Seconds before considering an object potentially static" ),
700 new PhysParameterEntry("LinearSleepingThreshold", "Seconds to measure linear movement before considering static" ), 766 new PhysParameterEntry("LinearSleepingThreshold", "Seconds to measure linear movement before considering static" ),
701 new PhysParameterEntry("AngularSleepingThreshold", "Seconds to measure angular movement before considering static" ), 767 new PhysParameterEntry("AngularSleepingThreshold", "Seconds to measure angular movement before considering static" ),
702 // new PhysParameterEntry("CcdMotionThreshold", "" ), 768 new PhysParameterEntry("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" ),
703 // new PhysParameterEntry("CcdSweptSphereRadius", "" ), 769 new PhysParameterEntry("CcdSweptSphereRadius", "Continuious collision detection test radius" ),
704 new PhysParameterEntry("ContactProcessingThreshold", "Distance between contacts before doing collision check" ), 770 new PhysParameterEntry("ContactProcessingThreshold", "Distance between contacts before doing collision check" ),
771 // Can only change the following at initialization time. Change the INI file and reboot.
772 new PhysParameterEntry("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default)"),
773 new PhysParameterEntry("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count"),
774 new PhysParameterEntry("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step"),
775 new PhysParameterEntry("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction"),
776 new PhysParameterEntry("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands"),
777 new PhysParameterEntry("ShouldEnableFrictionCaching", "Enable friction computation caching"),
778 new PhysParameterEntry("NumberOfSolverIterations", "Number of internal iterations (0 means default)"),
779
780 new PhysParameterEntry("Friction", "Set friction parameter for a specific object" ),
781 new PhysParameterEntry("Restitution", "Set restitution parameter for a specific object" ),
782
783 new PhysParameterEntry("Friction", "Set friction parameter for a specific object" ),
784 new PhysParameterEntry("Restitution", "Set restitution parameter for a specific object" ),
705 785
706 new PhysParameterEntry("TerrainFriction", "Factor to reduce movement against terrain surface" ), 786 new PhysParameterEntry("TerrainFriction", "Factor to reduce movement against terrain surface" ),
707 new PhysParameterEntry("TerrainHitFraction", "Distance to measure hit collisions" ), 787 new PhysParameterEntry("TerrainHitFraction", "Distance to measure hit collisions" ),
@@ -710,7 +790,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
710 new PhysParameterEntry("AvatarDensity", "Density of an avatar. Changed on avatar recreation." ), 790 new PhysParameterEntry("AvatarDensity", "Density of an avatar. Changed on avatar recreation." ),
711 new PhysParameterEntry("AvatarRestitution", "Bouncyness. Changed on avatar recreation." ), 791 new PhysParameterEntry("AvatarRestitution", "Bouncyness. Changed on avatar recreation." ),
712 new PhysParameterEntry("AvatarCapsuleRadius", "Radius of space around an avatar" ), 792 new PhysParameterEntry("AvatarCapsuleRadius", "Radius of space around an avatar" ),
713 new PhysParameterEntry("AvatarCapsuleHeight", "Default height of space around avatar" ) 793 new PhysParameterEntry("AvatarCapsuleHeight", "Default height of space around avatar" ),
794 new PhysParameterEntry("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions")
795
714 }; 796 };
715 797
716 #region IPhysicsParameters 798 #region IPhysicsParameters
@@ -733,6 +815,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
733 switch (lparm) 815 switch (lparm)
734 { 816 {
735 case "detailedstats": m_detailedStatsStep = (int)val; break; 817 case "detailedstats": m_detailedStatsStep = (int)val; break;
818
736 case "meshlod": m_meshLOD = (int)val; break; 819 case "meshlod": m_meshLOD = (int)val; break;
737 case "sculptlod": m_sculptLOD = (int)val; break; 820 case "sculptlod": m_sculptLOD = (int)val; break;
738 case "maxsubstep": m_maxSubSteps = (int)val; break; 821 case "maxsubstep": m_maxSubSteps = (int)val; break;
@@ -743,7 +826,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
743 case "defaultdensity": m_params[0].defaultDensity = val; break; 826 case "defaultdensity": m_params[0].defaultDensity = val; break;
744 case "defaultrestitution": m_params[0].defaultRestitution = val; break; 827 case "defaultrestitution": m_params[0].defaultRestitution = val; break;
745 case "collisionmargin": m_params[0].collisionMargin = val; break; 828 case "collisionmargin": m_params[0].collisionMargin = val; break;
746 case "gravity": m_params[0].gravity = val; TaintedUpdateParameter(lparm, PhysParameterEntry.APPLY_TO_NONE, val); break; 829 case "gravity": m_params[0].gravity = val; TaintedUpdateParameter(lparm, localID, val); break;
747 830
748 case "lineardamping": UpdateParameterPrims(ref m_params[0].linearDamping, lparm, localID, val); break; 831 case "lineardamping": UpdateParameterPrims(ref m_params[0].linearDamping, lparm, localID, val); break;
749 case "angulardamping": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break; 832 case "angulardamping": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break;
@@ -753,6 +836,17 @@ public class BSScene : PhysicsScene, IPhysicsParameters
753 case "ccdmotionthreshold": UpdateParameterPrims(ref m_params[0].ccdMotionThreshold, lparm, localID, val); break; 836 case "ccdmotionthreshold": UpdateParameterPrims(ref m_params[0].ccdMotionThreshold, lparm, localID, val); break;
754 case "ccdsweptsphereradius": UpdateParameterPrims(ref m_params[0].ccdSweptSphereRadius, lparm, localID, val); break; 837 case "ccdsweptsphereradius": UpdateParameterPrims(ref m_params[0].ccdSweptSphereRadius, lparm, localID, val); break;
755 case "contactprocessingthreshold": UpdateParameterPrims(ref m_params[0].contactProcessingThreshold, lparm, localID, val); break; 838 case "contactprocessingthreshold": UpdateParameterPrims(ref m_params[0].contactProcessingThreshold, lparm, localID, val); break;
839 // the following are used only at initialization time so setting them makes no sense
840 // case "maxPersistantmanifoldpoolSize": m_params[0].maxPersistantManifoldPoolSize = val; break;
841 // case "shoulddisablecontactpooldynamicallocation": m_params[0].shouldDisableContactPoolDynamicAllocation = val; break;
842 // case "shouldforceupdateallaabbs": m_params[0].shouldForceUpdateAllAabbs = val; break;
843 // case "shouldrandomizesolverorder": m_params[0].shouldRandomizeSolverOrder = val; break;
844 // case "shouldsplitsimulationislands": m_params[0].shouldSplitSimulationIslands = val; break;
845 // case "shouldenablefrictioncaching": m_params[0].shouldEnableFrictionCaching = val; break;
846 // case "numberofsolveriterations": m_params[0].numberOfSolverIterations = val; break;
847
848 case "friction": TaintedUpdateParameter(lparm, localID, val); break;
849 case "restitution": TaintedUpdateParameter(lparm, localID, val); break;
756 850
757 // set a terrain physical feature and cause terrain to be recalculated 851 // set a terrain physical feature and cause terrain to be recalculated
758 case "terrainfriction": m_params[0].terrainFriction = val; TaintedUpdateParameter("terrain", 0, val); break; 852 case "terrainfriction": m_params[0].terrainFriction = val; TaintedUpdateParameter("terrain", 0, val); break;
@@ -764,6 +858,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
764 case "avatarrestitution": UpdateParameterAvatars(ref m_params[0].avatarRestitution, "avatar", localID, val); break; 858 case "avatarrestitution": UpdateParameterAvatars(ref m_params[0].avatarRestitution, "avatar", localID, val); break;
765 case "avatarcapsuleradius": UpdateParameterAvatars(ref m_params[0].avatarCapsuleRadius, "avatar", localID, val); break; 859 case "avatarcapsuleradius": UpdateParameterAvatars(ref m_params[0].avatarCapsuleRadius, "avatar", localID, val); break;
766 case "avatarcapsuleheight": UpdateParameterAvatars(ref m_params[0].avatarCapsuleHeight, "avatar", localID, val); break; 860 case "avatarcapsuleheight": UpdateParameterAvatars(ref m_params[0].avatarCapsuleHeight, "avatar", localID, val); break;
861 case "avatarcontactprocessingthreshold": UpdateParameterAvatars(ref m_params[0].avatarContactProcessingThreshold, "avatar", localID, val); break;
767 862
768 default: ret = false; break; 863 default: ret = false; break;
769 } 864 }
@@ -856,6 +951,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters
856 case "ccdmotionthreshold": val = m_params[0].ccdMotionThreshold; break; 951 case "ccdmotionthreshold": val = m_params[0].ccdMotionThreshold; break;
857 case "ccdsweptsphereradius": val = m_params[0].ccdSweptSphereRadius; break; 952 case "ccdsweptsphereradius": val = m_params[0].ccdSweptSphereRadius; break;
858 case "contactprocessingthreshold": val = m_params[0].contactProcessingThreshold; break; 953 case "contactprocessingthreshold": val = m_params[0].contactProcessingThreshold; break;
954 case "maxPersistantmanifoldpoolSize": val = m_params[0].maxPersistantManifoldPoolSize; break;
955 case "shoulddisablecontactpooldynamicallocation": val = m_params[0].shouldDisableContactPoolDynamicAllocation; break;
956 case "shouldforceupdateallaabbs": val = m_params[0].shouldForceUpdateAllAabbs; break;
957 case "shouldrandomizesolverorder": val = m_params[0].shouldRandomizeSolverOrder; break;
958 case "shouldsplitsimulationislands": val = m_params[0].shouldSplitSimulationIslands; break;
959 case "shouldenablefrictioncaching": val = m_params[0].shouldEnableFrictionCaching; break;
960 case "numberofsolveriterations": val = m_params[0].numberOfSolverIterations; break;
859 961
860 case "terrainfriction": val = m_params[0].terrainFriction; break; 962 case "terrainfriction": val = m_params[0].terrainFriction; break;
861 case "terrainhitfraction": val = m_params[0].terrainHitFraction; break; 963 case "terrainhitfraction": val = m_params[0].terrainHitFraction; break;
@@ -866,6 +968,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
866 case "avatarrestitution": val = m_params[0].avatarRestitution; break; 968 case "avatarrestitution": val = m_params[0].avatarRestitution; break;
867 case "avatarcapsuleradius": val = m_params[0].avatarCapsuleRadius; break; 969 case "avatarcapsuleradius": val = m_params[0].avatarCapsuleRadius; break;
868 case "avatarcapsuleheight": val = m_params[0].avatarCapsuleHeight; break; 970 case "avatarcapsuleheight": val = m_params[0].avatarCapsuleHeight; break;
971 case "avatarcontactprocessingthreshold": val = m_params[0].avatarContactProcessingThreshold; break;
869 default: ret = false; break; 972 default: ret = false; break;
870 973
871 } 974 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index d12bd7d..086f0dc 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -132,6 +132,15 @@ public struct ConfigurationParameters
132 public float avatarRestitution; 132 public float avatarRestitution;
133 public float avatarCapsuleRadius; 133 public float avatarCapsuleRadius;
134 public float avatarCapsuleHeight; 134 public float avatarCapsuleHeight;
135 public float avatarContactProcessingThreshold;
136
137 public float maxPersistantManifoldPoolSize;
138 public float shouldDisableContactPoolDynamicAllocation;
139 public float shouldForceUpdateAllAabbs;
140 public float shouldRandomizeSolverOrder;
141 public float shouldSplitSimulationIslands;
142 public float shouldEnableFrictionCaching;
143 public float numberOfSolverIterations;
135 144
136 public const float numericTrue = 1f; 145 public const float numericTrue = 1f;
137 public const float numericFalse = 0f; 146 public const float numericFalse = 0f;
@@ -149,16 +158,16 @@ public static extern uint Initialize(Vector3 maxPosition, IntPtr parms,
149 int maxUpdates, IntPtr updateArray); 158 int maxUpdates, IntPtr updateArray);
150 159
151[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 160[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
152public static extern bool UpdateParameter(uint worldID, uint localID,
153 [MarshalAs(UnmanagedType.LPStr)]string paramCode, float value);
154
155[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
156public static extern void SetHeightmap(uint worldID, [MarshalAs(UnmanagedType.LPArray)] float[] heightMap); 161public static extern void SetHeightmap(uint worldID, [MarshalAs(UnmanagedType.LPArray)] float[] heightMap);
157 162
158[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 163[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
159public static extern void Shutdown(uint worldID); 164public static extern void Shutdown(uint worldID);
160 165
166[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
167public static extern bool UpdateParameter(uint worldID, uint localID,
168 [MarshalAs(UnmanagedType.LPStr)]string paramCode, float value);
161 169
170// ===============================================================================
162[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 171[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
163public static extern int PhysicsStep(uint worldID, float timeStep, int maxSubSteps, float fixedTimeStep, 172public static extern int PhysicsStep(uint worldID, float timeStep, int maxSubSteps, float fixedTimeStep,
164 out int updatedEntityCount, 173 out int updatedEntityCount,
@@ -240,6 +249,7 @@ public static extern bool HasObject(uint worldID, uint id);
240[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 249[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
241public static extern bool DestroyObject(uint worldID, uint id); 250public static extern bool DestroyObject(uint worldID, uint id);
242 251
252// ===============================================================================
243[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 253[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
244public static extern SweepHit ConvexSweepTest(uint worldID, uint id, Vector3 to, float extraMargin); 254public static extern SweepHit ConvexSweepTest(uint worldID, uint id, Vector3 to, float extraMargin);
245 255
@@ -249,6 +259,7 @@ public static extern RaycastHit RayTest(uint worldID, uint id, Vector3 from, Vec
249[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 259[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
250public static extern Vector3 RecoverFromPenetration(uint worldID, uint id); 260public static extern Vector3 RecoverFromPenetration(uint worldID, uint id);
251 261
262// ===============================================================================
252[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 263[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
253public static extern void DumpBulletStatistics(); 264public static extern void DumpBulletStatistics();
254 265
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index 2942104..7c07e15 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -120,33 +120,110 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
120 /// 120 ///
121 /// </summary> 121 /// </summary>
122 /// <param name="fname">The name of the function to invoke</param> 122 /// <param name="fname">The name of the function to invoke</param>
123 /// <param name="fname">List of parameters</param> 123 /// <param name="parms">List of parameters</param>
124 /// <returns>string result of the invocation</returns> 124 /// <returns>string result of the invocation</returns>
125 public string modInvokeS(string fname, params object[] parms) 125 public void modInvokeN(string fname, params object[] parms)
126 { 126 {
127 Type returntype = m_comms.LookupReturnType(fname); 127 Type returntype = m_comms.LookupReturnType(fname);
128 if (returntype != typeof(string)) 128 if (returntype != typeof(string))
129 MODError(String.Format("return type mismatch for {0}",fname)); 129 MODError(String.Format("return type mismatch for {0}",fname));
130 130
131 return (string)modInvoke(fname,parms); 131 modInvoke(fname,parms);
132 } 132 }
133 133
134 public int modInvokeI(string fname, params object[] parms) 134 public LSL_String modInvokeS(string fname, params object[] parms)
135 {
136 Type returntype = m_comms.LookupReturnType(fname);
137 if (returntype != typeof(string))
138 MODError(String.Format("return type mismatch for {0}",fname));
139
140 string result = (string)modInvoke(fname,parms);
141 return new LSL_String(result);
142 }
143
144 public LSL_Integer modInvokeI(string fname, params object[] parms)
135 { 145 {
136 Type returntype = m_comms.LookupReturnType(fname); 146 Type returntype = m_comms.LookupReturnType(fname);
137 if (returntype != typeof(int)) 147 if (returntype != typeof(int))
138 MODError(String.Format("return type mismatch for {0}",fname)); 148 MODError(String.Format("return type mismatch for {0}",fname));
139 149
140 return (int)modInvoke(fname,parms); 150 int result = (int)modInvoke(fname,parms);
151 return new LSL_Integer(result);
141 } 152 }
142 153
143 public float modInvokeF(string fname, params object[] parms) 154 public LSL_Float modInvokeF(string fname, params object[] parms)
144 { 155 {
145 Type returntype = m_comms.LookupReturnType(fname); 156 Type returntype = m_comms.LookupReturnType(fname);
146 if (returntype != typeof(float)) 157 if (returntype != typeof(float))
147 MODError(String.Format("return type mismatch for {0}",fname)); 158 MODError(String.Format("return type mismatch for {0}",fname));
148 159
149 return (float)modInvoke(fname,parms); 160 float result = (float)modInvoke(fname,parms);
161 return new LSL_Float(result);
162 }
163
164 public LSL_Key modInvokeK(string fname, params object[] parms)
165 {
166 Type returntype = m_comms.LookupReturnType(fname);
167 if (returntype != typeof(UUID))
168 MODError(String.Format("return type mismatch for {0}",fname));
169
170 UUID result = (UUID)modInvoke(fname,parms);
171 return new LSL_Key(result.ToString());
172 }
173
174 public LSL_Vector modInvokeV(string fname, params object[] parms)
175 {
176 Type returntype = m_comms.LookupReturnType(fname);
177 if (returntype != typeof(OpenMetaverse.Vector3))
178 MODError(String.Format("return type mismatch for {0}",fname));
179
180 OpenMetaverse.Vector3 result = (OpenMetaverse.Vector3)modInvoke(fname,parms);
181 return new LSL_Vector(result.X,result.Y,result.Z);
182 }
183
184 public LSL_Rotation modInvokeR(string fname, params object[] parms)
185 {
186 Type returntype = m_comms.LookupReturnType(fname);
187 if (returntype != typeof(OpenMetaverse.Quaternion))
188 MODError(String.Format("return type mismatch for {0}",fname));
189
190 OpenMetaverse.Quaternion result = (OpenMetaverse.Quaternion)modInvoke(fname,parms);
191 return new LSL_Rotation(result.X,result.Y,result.Z,result.W);
192 }
193
194 public LSL_List modInvokeL(string fname, params object[] parms)
195 {
196 Type returntype = m_comms.LookupReturnType(fname);
197 if (returntype != typeof(object[]))
198 MODError(String.Format("return type mismatch for {0}",fname));
199
200 object[] result = (object[])modInvoke(fname,parms);
201 object[] llist = new object[result.Length];
202 for (int i = 0; i < result.Length; i++)
203 {
204 if (result[i] is string)
205 llist[i] = new LSL_String((string)result[i]);
206 else if (result[i] is int)
207 llist[i] = new LSL_Integer((int)result[i]);
208 else if (result[i] is float)
209 llist[i] = new LSL_Float((float)result[i]);
210 else if (result[i] is OpenMetaverse.Vector3)
211 {
212 OpenMetaverse.Vector3 vresult = (OpenMetaverse.Vector3)result[i];
213 llist[i] = new LSL_Vector(vresult.X,vresult.Y,vresult.Z);
214 }
215 else if (result[i] is OpenMetaverse.Quaternion)
216 {
217 OpenMetaverse.Quaternion qresult = (OpenMetaverse.Quaternion)result[i];
218 llist[i] = new LSL_Rotation(qresult.X,qresult.Y,qresult.Z,qresult.W);
219 }
220 else
221 {
222 MODError(String.Format("unknown list element returned by {0}",fname));
223 }
224 }
225
226 return new LSL_List(llist);
150 } 227 }
151 228
152 /// <summary> 229 /// <summary>
@@ -168,63 +245,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
168 MODError(String.Format("wrong number of parameters to function {0}",fname)); 245 MODError(String.Format("wrong number of parameters to function {0}",fname));
169 246
170 object[] convertedParms = new object[parms.Length]; 247 object[] convertedParms = new object[parms.Length];
171
172 for (int i = 0; i < parms.Length; i++) 248 for (int i = 0; i < parms.Length; i++)
173 { 249 convertedParms[i] = ConvertFromLSL(parms[i],signature[i]);
174 if (parms[i] is LSL_String)
175 {
176 if (signature[i] != typeof(string))
177 MODError(String.Format("parameter type mismatch in {0}; expecting {1}",fname,signature[i].Name));
178 250
179 convertedParms[i] = (string)(LSL_String)parms[i]; 251 // now call the function, the contract with the function is that it will always return
180 } 252 // non-null but don't trust it completely
181 else if (parms[i] is LSL_Integer) 253 try
182 { 254 {
183 if (signature[i] != typeof(int)) 255 object result = m_comms.InvokeOperation(m_host.UUID, m_itemID, fname, convertedParms);
184 MODError(String.Format("parameter type mismatch in {0}; expecting {1}",fname,signature[i].Name)); 256 if (result != null)
185 257 return result;
186 convertedParms[i] = (int)(LSL_Integer)parms[i];
187 }
188 else if (parms[i] is LSL_Float)
189 {
190 if (signature[i] != typeof(float))
191 MODError(String.Format("parameter type mismatch in {0}; expecting {1}",fname,signature[i].Name));
192
193 convertedParms[i] = (float)(LSL_Float)parms[i];
194 }
195 else if (parms[i] is LSL_Key)
196 {
197 if (signature[i] != typeof(string))
198 MODError(String.Format("parameter type mismatch in {0}; expecting {1}",fname,signature[i].Name));
199
200 convertedParms[i] = (string)(LSL_Key)parms[i];
201 }
202 else if (parms[i] is LSL_Rotation)
203 {
204 if (signature[i] != typeof(string))
205 MODError(String.Format("parameter type mismatch in {0}; expecting {1}",fname,signature[i].Name));
206
207 convertedParms[i] = (string)(LSL_Rotation)parms[i];
208 }
209 else if (parms[i] is LSL_Vector)
210 {
211 if (signature[i] != typeof(string))
212 MODError(String.Format("parameter type mismatch in {0}; expecting {1}",fname,signature[i].Name));
213
214 convertedParms[i] = (string)(LSL_Vector)parms[i];
215 }
216 else
217 {
218 if (signature[i] != parms[i].GetType())
219 MODError(String.Format("parameter type mismatch in {0}; expecting {1}",fname,signature[i].Name));
220 258
221 convertedParms[i] = parms[i]; 259 MODError(String.Format("Invocation of {0} failed; null return value",fname));
222 } 260 }
261 catch (Exception e)
262 {
263 MODError(String.Format("Invocation of {0} failed; {1}",fname,e.Message));
223 } 264 }
224 265
225 return m_comms.InvokeOperation(m_itemID,fname,convertedParms); 266 return null;
226 } 267 }
227 268
269 /// <summary>
270 /// Send a command to functions registered on an event
271 /// </summary>
228 public string modSendCommand(string module, string command, string k) 272 public string modSendCommand(string module, string command, string k)
229 { 273 {
230 if (!m_MODFunctionsEnabled) 274 if (!m_MODFunctionsEnabled)
@@ -239,5 +283,101 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
239 283
240 return req.ToString(); 284 return req.ToString();
241 } 285 }
286
287 /// <summary>
288 /// </summary>
289 protected object ConvertFromLSL(object lslparm, Type type)
290 {
291 // ---------- String ----------
292 if (lslparm is LSL_String)
293 {
294 if (type == typeof(string))
295 return (string)(LSL_String)lslparm;
296
297 // Need to check for UUID since keys are often treated as strings
298 if (type == typeof(UUID))
299 return new UUID((string)(LSL_String)lslparm);
300 }
301
302 // ---------- Integer ----------
303 else if (lslparm is LSL_Integer)
304 {
305 if (type == typeof(int))
306 return (int)(LSL_Integer)lslparm;
307 }
308
309 // ---------- Float ----------
310 else if (lslparm is LSL_Float)
311 {
312 if (type == typeof(float))
313 return (float)(LSL_Float)lslparm;
314 }
315
316 // ---------- Key ----------
317 else if (lslparm is LSL_Key)
318 {
319 if (type == typeof(UUID))
320 return new UUID((LSL_Key)lslparm);
321 }
322
323 // ---------- Rotation ----------
324 else if (lslparm is LSL_Rotation)
325 {
326 if (type == typeof(OpenMetaverse.Quaternion))
327 {
328 LSL_Rotation rot = (LSL_Rotation)lslparm;
329 return new OpenMetaverse.Quaternion((float)rot.x,(float)rot.y,(float)rot.z,(float)rot.s);
330 }
331 }
332
333 // ---------- Vector ----------
334 else if (lslparm is LSL_Vector)
335 {
336 if (type == typeof(OpenMetaverse.Vector3))
337 {
338 LSL_Vector vect = (LSL_Vector)lslparm;
339 return new OpenMetaverse.Vector3((float)vect.x,(float)vect.y,(float)vect.z);
340 }
341 }
342
343 // ---------- List ----------
344 else if (lslparm is LSL_List)
345 {
346 if (type == typeof(object[]))
347 {
348 object[] plist = (lslparm as LSL_List).Data;
349 object[] result = new object[plist.Length];
350 for (int i = 0; i < plist.Length; i++)
351 {
352 if (plist[i] is LSL_String)
353 result[i] = (string)(LSL_String)plist[i];
354 else if (plist[i] is LSL_Integer)
355 result[i] = (int)(LSL_Integer)plist[i];
356 else if (plist[i] is LSL_Float)
357 result[i] = (float)(LSL_Float)plist[i];
358 else if (plist[i] is LSL_Key)
359 result[i] = new UUID((LSL_Key)plist[i]);
360 else if (plist[i] is LSL_Rotation)
361 {
362 LSL_Rotation rot = (LSL_Rotation)plist[i];
363 result[i] = new OpenMetaverse.Quaternion((float)rot.x,(float)rot.y,(float)rot.z,(float)rot.s);
364 }
365 else if (plist[i] is LSL_Vector)
366 {
367 LSL_Vector vect = (LSL_Vector)plist[i];
368 result[i] = new OpenMetaverse.Vector3((float)vect.x,(float)vect.y,(float)vect.z);
369 }
370 else
371 MODError("unknown LSL list element type");
372 }
373
374 return result;
375 }
376 }
377
378 MODError(String.Format("parameter type mismatch; expecting {0}",type.Name));
379 return null;
380 }
381
242 } 382 }
243} 383}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IMOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IMOD_Api.cs
index 756a59f..aa78aaa 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IMOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IMOD_Api.cs
@@ -28,26 +28,27 @@
28using System.Collections; 28using System.Collections;
29using OpenSim.Region.ScriptEngine.Interfaces; 29using OpenSim.Region.ScriptEngine.Interfaces;
30 30
31using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 31using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
32using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; 32using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
33using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; 33using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
34using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; 34using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
35using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
35using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 36using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
36using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; 37using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
37using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
38 38
39namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces 39namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
40{ 40{
41 public interface IMOD_Api 41 public interface IMOD_Api
42 { 42 {
43 // Invocation functions 43 // Invocation functions
44 string modInvokeS(string fname, params object[] parms); 44 void modInvokeN(string fname, params object[] parms);
45 int modInvokeI(string fname, params object[] parms); 45 LSL_String modInvokeS(string fname, params object[] parms);
46 float modInvokeF(string fname, params object[] parms); 46 LSL_Integer modInvokeI(string fname, params object[] parms);
47 // vector modInvokeV(string fname, params object[] parms); 47 LSL_Float modInvokeF(string fname, params object[] parms);
48 // rotation modInvokeV(string fname, params object[] parms); 48 LSL_Key modInvokeK(string fname, params object[] parms);
49 // key modInvokeK(string fname, params object[] parms); 49 LSL_Vector modInvokeV(string fname, params object[] parms);
50 // list modInvokeL(string fname, params object[] parms); 50 LSL_Rotation modInvokeR(string fname, params object[] parms);
51 LSL_List modInvokeL(string fname, params object[] parms);
51 52
52 //Module functions 53 //Module functions
53 string modSendCommand(string modules, string command, string k); 54 string modSendCommand(string modules, string command, string k);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/MOD_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/MOD_Stub.cs
index 04b7f14..1c47138 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/MOD_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/MOD_Stub.cs
@@ -39,10 +39,14 @@ using integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
39using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; 39using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
40using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; 40using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
41using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 41using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
42using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; 42
43using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
44using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; 43using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
45using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; 44using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
45using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
46using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
47using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
48using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
49using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
46 50
47namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase 51namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
48{ 52{
@@ -58,21 +62,46 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
58 m_MOD_Functions = (IMOD_Api)api; 62 m_MOD_Functions = (IMOD_Api)api;
59 } 63 }
60 64
61 public string modInvokeS(string fname, params object[] parms) 65 public void modInvokeN(string fname, params object[] parms)
66 {
67 m_MOD_Functions.modInvokeN(fname, parms);
68 }
69
70 public LSL_String modInvokeS(string fname, params object[] parms)
62 { 71 {
63 return m_MOD_Functions.modInvokeS(fname, parms); 72 return m_MOD_Functions.modInvokeS(fname, parms);
64 } 73 }
65 74
66 public int modInvokeI(string fname, params object[] parms) 75 public LSL_Integer modInvokeI(string fname, params object[] parms)
67 { 76 {
68 return m_MOD_Functions.modInvokeI(fname, parms); 77 return m_MOD_Functions.modInvokeI(fname, parms);
69 } 78 }
70 79
71 public float modInvokeF(string fname, params object[] parms) 80 public LSL_Float modInvokeF(string fname, params object[] parms)
72 { 81 {
73 return m_MOD_Functions.modInvokeF(fname, parms); 82 return m_MOD_Functions.modInvokeF(fname, parms);
74 } 83 }
75 84
85 public LSL_Key modInvokeK(string fname, params object[] parms)
86 {
87 return m_MOD_Functions.modInvokeK(fname, parms);
88 }
89
90 public LSL_Vector modInvokeV(string fname, params object[] parms)
91 {
92 return m_MOD_Functions.modInvokeV(fname, parms);
93 }
94
95 public LSL_Rotation modInvokeR(string fname, params object[] parms)
96 {
97 return m_MOD_Functions.modInvokeR(fname, parms);
98 }
99
100 public LSL_List modInvokeL(string fname, params object[] parms)
101 {
102 return m_MOD_Functions.modInvokeL(fname, parms);
103 }
104
76 public string modSendCommand(string module, string command, string k) 105 public string modSendCommand(string module, string command, string k)
77 { 106 {
78 return m_MOD_Functions.modSendCommand(module, command, k); 107 return m_MOD_Functions.modSendCommand(module, command, k);
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index 6986046..28c5587 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -846,10 +846,12 @@
846 TerrainFriction = 0.50 846 TerrainFriction = 0.50
847 TerrainHitFriction = 0.8 847 TerrainHitFriction = 0.8
848 TerrainRestitution = 0 848 TerrainRestitution = 0
849 AvatarFriction = 0 849 AvatarFriction = 0.2
850 AvatarRestitution = 0.0
850 AvatarDensity = 60.0 851 AvatarDensity = 60.0
851 AvatarCapsuleRadius = 0.37 852 AvatarCapsuleRadius = 0.37
852 AvatarCapsuleHeight = 1.5 853 AvatarCapsuleHeight = 1.5
854 AvatarContactProcessingThreshold = 0.1;
853 855
854 MaxObjectMass = 10000.01 856 MaxObjectMass = 10000.01
855 857
@@ -862,6 +864,15 @@
862 CcdMotionThreshold = 0.0 864 CcdMotionThreshold = 0.0
863 CcdSweptSphereRadius = 0.0 865 CcdSweptSphereRadius = 0.0
864 ContactProcessingThreshold = 0.1 866 ContactProcessingThreshold = 0.1
867 ; If setting a pool size, also disable dynamic allocation (default pool size is 4096 with dynamic alloc)
868 MaxPersistantManifoldPoolSize = 0;
869 ShouldDisableContactPoolDynamicAllocation = False;
870 ShouldForceUpdateAllAabbs = False;
871 ShouldRandomizeSolverOrder = False;
872 ShouldSplitSimulationIslands = False;
873 ShouldEnableFrictionCaching = False;
874 NumberOfSolverIterations = 0;
875
865 876
866 ; Whether to mesh sculpties 877 ; Whether to mesh sculpties
867 MeshSculptedPrim = true 878 MeshSculptedPrim = true
diff --git a/bin/lib32/BulletSim.dll b/bin/lib32/BulletSim.dll
index d1571cf..5bef6e9 100755
--- a/bin/lib32/BulletSim.dll
+++ b/bin/lib32/BulletSim.dll
Binary files differ
diff --git a/bin/lib32/libBulletSim.so b/bin/lib32/libBulletSim.so
new file mode 100755
index 0000000..9882f5b
--- /dev/null
+++ b/bin/lib32/libBulletSim.so
Binary files differ
diff --git a/bin/lib64/BulletSim.dll b/bin/lib64/BulletSim.dll
index ec21dfe..9f09ef8 100755
--- a/bin/lib64/BulletSim.dll
+++ b/bin/lib64/BulletSim.dll
Binary files differ
diff --git a/bin/lib64/libBulletSim.so b/bin/lib64/libBulletSim.so
new file mode 100755
index 0000000..fa47bf1
--- /dev/null
+++ b/bin/lib64/libBulletSim.so
Binary files differ