aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/SharedBase
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/PhysicsModules/SharedBase')
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs31
-rwxr-xr-x[-rw-r--r--]OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs0
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs2
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs311
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs85
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs2
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs47
8 files changed, 365 insertions, 115 deletions
diff --git a/OpenSim/Region/PhysicsModules/SharedBase/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/SharedBase/AssemblyInfo.cs
index 33f60e4..9027e2e 100644
--- a/OpenSim/Region/PhysicsModules/SharedBase/AssemblyInfo.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/AssemblyInfo.cs
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
55// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
57 57
58[assembly : AssemblyVersion("0.8.2.*")] 58[assembly : AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)]
diff --git a/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs b/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs
index 5c75307..1a8409e 100644
--- a/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Runtime.InteropServices;
30using OpenSim.Framework; 31using OpenSim.Framework;
31using OpenMetaverse; 32using OpenMetaverse;
32 33
@@ -36,13 +37,18 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
36 { 37 {
37 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod); 38 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod);
38 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical); 39 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical);
39 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache); 40 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex, bool forOde);
41 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache, bool convex, bool forOde);
42 IMesh GetMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex);
43 void ReleaseMesh(IMesh mesh);
44 void ExpireReleaseMeshs();
45 void ExpireFileCache();
40 } 46 }
41 47
42 // Values for level of detail to be passed to the mesher. 48 // Values for level of detail to be passed to the mesher.
43 // Values origionally chosen for the LOD of sculpties (the sqrt(width*heigth) of sculpt texture) 49 // Values origionally chosen for the LOD of sculpties (the sqrt(width*heigth) of sculpt texture)
44 // Lower level of detail reduces the number of vertices used to represent the meshed shape. 50 // Lower level of detail reduces the number of vertices used to represent the meshed shape.
45 public enum LevelOfDetail 51 public enum LevelOfDetail
46 { 52 {
47 High = 32, 53 High = 32,
48 Medium = 16, 54 Medium = 16,
@@ -54,6 +60,25 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
54 { 60 {
55 } 61 }
56 62
63 [Serializable()]
64 [StructLayout(LayoutKind.Explicit)]
65 public struct AMeshKey
66 {
67 [FieldOffset(0)]
68 public UUID uuid;
69 [FieldOffset(0)]
70 public ulong hashA;
71 [FieldOffset(8)]
72 public ulong hashB;
73 [FieldOffset(16)]
74 public ulong hashC;
75
76 public override string ToString()
77 {
78 return uuid.ToString() + "-" + hashC.ToString("x") ;
79 }
80 }
81
57 public interface IMesh 82 public interface IMesh
58 { 83 {
59 List<Vector3> getVertexList(); 84 List<Vector3> getVertexList();
@@ -67,5 +92,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
67 void releasePinned(); 92 void releasePinned();
68 void Append(IMesh newMesh); 93 void Append(IMesh newMesh);
69 void TransformLinear(float[,] matrix, float[] offset); 94 void TransformLinear(float[,] matrix, float[] offset);
95 Vector3 GetCentroid();
96 Vector3 GetOBB();
70 } 97 }
71} 98}
diff --git a/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs b/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs
index fb0c9e2..fb0c9e2 100644..100755
--- a/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs
diff --git a/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs
index 432708c..8079e79 100644
--- a/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs
@@ -37,7 +37,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
37 class NullPhysicsScene : PhysicsScene 37 class NullPhysicsScene : PhysicsScene
38 { 38 {
39 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 39 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 40
41 private static int m_workIndicator; 41 private static int m_workIndicator;
42 42
43 public override PhysicsActor AddAvatar( 43 public override PhysicsActor AddAvatar(
diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
index c04ff58..2fa98b5 100644
--- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
@@ -43,7 +43,8 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
43 Unknown = 0, 43 Unknown = 0,
44 Agent = 1, 44 Agent = 1,
45 Prim = 2, 45 Prim = 2,
46 Ground = 3 46 Ground = 3,
47 Water = 4
47 } 48 }
48 49
49 public enum PIDHoverType 50 public enum PIDHoverType
@@ -54,20 +55,54 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
54 Absolute 55 Absolute
55 } 56 }
56 57
58 public struct CameraData
59 {
60 public Quaternion CameraRotation;
61 public Vector3 CameraAtAxis;
62 public bool MouseLook;
63 public bool Valid;
64 }
65
57 public struct ContactPoint 66 public struct ContactPoint
58 { 67 {
59 public Vector3 Position; 68 public Vector3 Position;
60 public Vector3 SurfaceNormal; 69 public Vector3 SurfaceNormal;
61 public float PenetrationDepth; 70 public float PenetrationDepth;
71 public float RelativeSpeed;
72 public bool CharacterFeet;
62 73
63 public ContactPoint(Vector3 position, Vector3 surfaceNormal, float penetrationDepth) 74 public ContactPoint(Vector3 position, Vector3 surfaceNormal, float penetrationDepth)
64 { 75 {
65 Position = position; 76 Position = position;
66 SurfaceNormal = surfaceNormal; 77 SurfaceNormal = surfaceNormal;
67 PenetrationDepth = penetrationDepth; 78 PenetrationDepth = penetrationDepth;
79 RelativeSpeed = 0f; // for now let this one be set explicity
80 CharacterFeet = true; // keep other plugins work as before
81 }
82
83 public ContactPoint(Vector3 position, Vector3 surfaceNormal, float penetrationDepth, bool feet)
84 {
85 Position = position;
86 SurfaceNormal = surfaceNormal;
87 PenetrationDepth = penetrationDepth;
88 RelativeSpeed = 0f; // for now let this one be set explicity
89 CharacterFeet = feet; // keep other plugins work as before
68 } 90 }
69 } 91 }
70 92
93 public struct ContactData
94 {
95 public float mu;
96 public float bounce;
97 public bool softcolide;
98
99 public ContactData(float _mu, float _bounce, bool _softcolide)
100 {
101 mu = _mu;
102 bounce = _bounce;
103 softcolide = _softcolide;
104 }
105 }
71 /// <summary> 106 /// <summary>
72 /// Used to pass collision information to OnCollisionUpdate listeners. 107 /// Used to pass collision information to OnCollisionUpdate listeners.
73 /// </summary> 108 /// </summary>
@@ -100,8 +135,19 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
100 } 135 }
101 else 136 else
102 { 137 {
138 float lastVel = m_objCollisionList[localID].RelativeSpeed;
103 if (m_objCollisionList[localID].PenetrationDepth < contact.PenetrationDepth) 139 if (m_objCollisionList[localID].PenetrationDepth < contact.PenetrationDepth)
140 {
141 if(Math.Abs(lastVel) > Math.Abs(contact.RelativeSpeed))
142 contact.RelativeSpeed = lastVel;
104 m_objCollisionList[localID] = contact; 143 m_objCollisionList[localID] = contact;
144 }
145 else if(Math.Abs(lastVel) < Math.Abs(contact.RelativeSpeed))
146 {
147 ContactPoint tmp = m_objCollisionList[localID];
148 tmp.RelativeSpeed = contact.RelativeSpeed;
149 m_objCollisionList[localID] = tmp;
150 }
105 } 151 }
106 } 152 }
107 153
@@ -121,13 +167,15 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
121 public delegate void RequestTerseUpdate(); 167 public delegate void RequestTerseUpdate();
122 public delegate void CollisionUpdate(EventArgs e); 168 public delegate void CollisionUpdate(EventArgs e);
123 public delegate void OutOfBounds(Vector3 pos); 169 public delegate void OutOfBounds(Vector3 pos);
170 public delegate CameraData GetCameraData();
124 171
125// disable warning: public events 172 // disable warning: public events
126#pragma warning disable 67 173#pragma warning disable 67
127 public event PositionUpdate OnPositionUpdate; 174 public event PositionUpdate OnPositionUpdate;
128 public event VelocityUpdate OnVelocityUpdate; 175 public event VelocityUpdate OnVelocityUpdate;
129 public event OrientationUpdate OnOrientationUpdate; 176 public event OrientationUpdate OnOrientationUpdate;
130 public event RequestTerseUpdate OnRequestTerseUpdate; 177 public event RequestTerseUpdate OnRequestTerseUpdate;
178 public event GetCameraData OnPhysicsRequestingCameraData;
131 179
132 /// <summary> 180 /// <summary>
133 /// Subscribers to this event must synchronously handle the dictionary of collisions received, since the event 181 /// Subscribers to this event must synchronously handle the dictionary of collisions received, since the event
@@ -138,15 +186,47 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
138 public event OutOfBounds OnOutOfBounds; 186 public event OutOfBounds OnOutOfBounds;
139#pragma warning restore 67 187#pragma warning restore 67
140 188
189 public CameraData TryGetCameraData()
190 {
191 GetCameraData handler = OnPhysicsRequestingCameraData;
192 if (handler != null)
193 {
194 return handler();
195 }
196
197 return new CameraData { Valid = false };
198 }
199
141 public static PhysicsActor Null 200 public static PhysicsActor Null
142 { 201 {
143 get { return new NullPhysicsActor(); } 202 get { return new NullPhysicsActor(); }
144 } 203 }
145 204
205 public virtual bool Building { get; set; }
206
207 public virtual void getContactData(ref ContactData cdata)
208 {
209 cdata.mu = 0;
210 cdata.bounce = 0;
211 }
212
146 public abstract bool Stopped { get; } 213 public abstract bool Stopped { get; }
147 214
148 public abstract Vector3 Size { get; set; } 215 public abstract Vector3 Size { get; set; }
149 216
217 public virtual void setAvatarSize(Vector3 size, float feetOffset)
218 {
219 Size = size;
220 }
221
222 public virtual bool Phantom { get; set; }
223
224 public virtual bool IsVolumeDtc
225 {
226 get { return false; }
227 set { return; }
228 }
229
150 public virtual byte PhysicsShapeType { get; set; } 230 public virtual byte PhysicsShapeType { get; set; }
151 231
152 public abstract PrimitiveBaseShape Shape { set; } 232 public abstract PrimitiveBaseShape Shape { set; }
@@ -169,20 +249,21 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
169 /// XXX: Bizarrely, this cannot be "Terrain" or "Water" right now unless it really is simulating terrain or 249 /// XXX: Bizarrely, this cannot be "Terrain" or "Water" right now unless it really is simulating terrain or
170 /// water. This is not a problem due to the formatting of names given by prims and avatars. 250 /// water. This is not a problem due to the formatting of names given by prims and avatars.
171 /// </remarks> 251 /// </remarks>
172 public string Name { get; protected set; } 252 public string Name { get; set; }
173 253
174 /// <summary> 254 /// <summary>
175 /// This is being used by ODE joint code. 255 /// This is being used by ODE joint code.
176 /// </summary> 256 /// </summary>
177 public string SOPName; 257 public string SOPName;
178 258
259 public virtual void CrossingStart() { }
179 public abstract void CrossingFailure(); 260 public abstract void CrossingFailure();
180 261
181 public abstract void link(PhysicsActor obj); 262 public abstract void link(PhysicsActor obj);
182 263
183 public abstract void delink(); 264 public abstract void delink();
184 265
185 public abstract void LockAngularMotion(Vector3 axis); 266 public abstract void LockAngularMotion(byte axislocks);
186 267
187 public virtual void RequestPhysicsterseUpdate() 268 public virtual void RequestPhysicsterseUpdate()
188 { 269 {
@@ -245,6 +326,56 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
245 public abstract void VehicleRotationParam(int param, Quaternion rotation); 326 public abstract void VehicleRotationParam(int param, Quaternion rotation);
246 public abstract void VehicleFlags(int param, bool remove); 327 public abstract void VehicleFlags(int param, bool remove);
247 328
329 // This is an overridable version of SetVehicle() that works for all physics engines.
330 // This is VERY inefficient. It behoves any physics engine to override this and
331 // implement a more efficient setting of all the vehicle parameters.
332 public virtual void SetVehicle(object pvdata)
333 {
334 VehicleData vdata = (VehicleData)pvdata;
335 // vehicleActor.ProcessSetVehicle((VehicleData)vdata);
336
337 this.VehicleType = (int)vdata.m_type;
338 this.VehicleFlags(-1, false); // clears all flags
339 this.VehicleFlags((int)vdata.m_flags, false);
340
341 // Linear properties
342 this.VehicleVectorParam((int)Vehicle.LINEAR_MOTOR_DIRECTION, vdata.m_linearMotorDirection);
343 this.VehicleVectorParam((int)Vehicle.LINEAR_FRICTION_TIMESCALE, vdata.m_linearFrictionTimescale);
344 this.VehicleFloatParam((int)Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE, vdata.m_linearMotorDecayTimescale);
345 this.VehicleFloatParam((int)Vehicle.LINEAR_MOTOR_TIMESCALE, vdata.m_linearMotorTimescale);
346 this.VehicleVectorParam((int)Vehicle.LINEAR_MOTOR_OFFSET, vdata.m_linearMotorOffset);
347
348 //Angular properties
349 this.VehicleVectorParam((int)Vehicle.ANGULAR_MOTOR_DIRECTION, vdata.m_angularMotorDirection);
350 this.VehicleFloatParam((int)Vehicle.ANGULAR_MOTOR_TIMESCALE, vdata.m_angularMotorTimescale);
351 this.VehicleFloatParam((int)Vehicle.ANGULAR_MOTOR_DECAY_TIMESCALE, vdata.m_angularMotorDecayTimescale);
352 this.VehicleVectorParam((int)Vehicle.ANGULAR_FRICTION_TIMESCALE, vdata.m_angularFrictionTimescale);
353
354 //Deflection properties
355 this.VehicleFloatParam((int)Vehicle.ANGULAR_DEFLECTION_EFFICIENCY, vdata.m_angularDeflectionEfficiency);
356 this.VehicleFloatParam((int)Vehicle.ANGULAR_DEFLECTION_TIMESCALE, vdata.m_angularDeflectionTimescale);
357 this.VehicleFloatParam((int)Vehicle.LINEAR_DEFLECTION_EFFICIENCY, vdata.m_linearDeflectionEfficiency);
358 this.VehicleFloatParam((int)Vehicle.LINEAR_DEFLECTION_TIMESCALE, vdata.m_linearDeflectionTimescale);
359
360 //Banking properties
361 this.VehicleFloatParam((int)Vehicle.BANKING_EFFICIENCY, vdata.m_bankingEfficiency);
362 this.VehicleFloatParam((int)Vehicle.BANKING_MIX, vdata.m_bankingMix);
363 this.VehicleFloatParam((int)Vehicle.BANKING_TIMESCALE, vdata.m_bankingTimescale);
364
365 //Hover and Buoyancy properties
366 this.VehicleFloatParam((int)Vehicle.HOVER_HEIGHT, vdata.m_VhoverHeight);
367 this.VehicleFloatParam((int)Vehicle.HOVER_EFFICIENCY, vdata.m_VhoverEfficiency);
368 this.VehicleFloatParam((int)Vehicle.HOVER_TIMESCALE, vdata.m_VhoverTimescale);
369 this.VehicleFloatParam((int)Vehicle.BUOYANCY, vdata.m_VehicleBuoyancy);
370
371 //Attractor properties
372 this.VehicleFloatParam((int)Vehicle.VERTICAL_ATTRACTION_EFFICIENCY, vdata.m_verticalAttractionEfficiency);
373 this.VehicleFloatParam((int)Vehicle.VERTICAL_ATTRACTION_TIMESCALE, vdata.m_verticalAttractionTimescale);
374
375 this.VehicleRotationParam((int)Vehicle.REFERENCE_FRAME, vdata.m_referenceFrame);
376 }
377
378
248 /// <summary> 379 /// <summary>
249 /// Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more 380 /// Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more
250 /// </summary> 381 /// </summary>
@@ -253,6 +384,22 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
253 public abstract Vector3 GeometricCenter { get; } 384 public abstract Vector3 GeometricCenter { get; }
254 public abstract Vector3 CenterOfMass { get; } 385 public abstract Vector3 CenterOfMass { get; }
255 386
387 public virtual float PhysicsCost
388 {
389 get
390 {
391 return 0.1f;
392 }
393 }
394
395 public virtual float StreamCost
396 {
397 get
398 {
399 return 1.0f;
400 }
401 }
402
256 /// <summary> 403 /// <summary>
257 /// The desired velocity of this actor. 404 /// The desired velocity of this actor.
258 /// </summary> 405 /// </summary>
@@ -271,6 +418,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
271 } 418 }
272 419
273 public abstract Vector3 Velocity { get; set; } 420 public abstract Vector3 Velocity { get; set; }
421 public virtual Vector3 rootVelocity { get { return Vector3.Zero; } }
274 422
275 public abstract Vector3 Torque { get; set; } 423 public abstract Vector3 Torque { get; set; }
276 public abstract float CollisionScore { get; set;} 424 public abstract float CollisionScore { get; set;}
@@ -296,7 +444,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
296 444
297 // Used for llSetHoverHeight and maybe vehicle height 445 // Used for llSetHoverHeight and maybe vehicle height
298 // Hover Height will override MoveTo target's Z 446 // Hover Height will override MoveTo target's Z
299 public abstract bool PIDHoverActive { set;} 447 public abstract bool PIDHoverActive {get; set;}
300 public abstract float PIDHoverHeight { set;} 448 public abstract float PIDHoverHeight { set;}
301 public abstract PIDHoverType PIDHoverType { set;} 449 public abstract PIDHoverType PIDHoverType { set;}
302 public abstract float PIDHoverTau { set;} 450 public abstract float PIDHoverTau { set;}
@@ -306,7 +454,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
306 public abstract bool APIDActive { set;} 454 public abstract bool APIDActive { set;}
307 public abstract float APIDStrength { set;} 455 public abstract float APIDStrength { set;}
308 public abstract float APIDDamping { set;} 456 public abstract float APIDDamping { set;}
309 457
310 public abstract void AddForce(Vector3 force, bool pushforce); 458 public abstract void AddForce(Vector3 force, bool pushforce);
311 public abstract void AddAngularForce(Vector3 force, bool pushforce); 459 public abstract void AddAngularForce(Vector3 force, bool pushforce);
312 public abstract void SetMomentum(Vector3 momentum); 460 public abstract void SetMomentum(Vector3 momentum);
@@ -314,6 +462,29 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
314 public abstract void UnSubscribeEvents(); 462 public abstract void UnSubscribeEvents();
315 public abstract bool SubscribedEvents(); 463 public abstract bool SubscribedEvents();
316 464
465 public virtual void AddCollisionEvent(uint CollidedWith, ContactPoint contact) { }
466 public virtual void AddVDTCCollisionEvent(uint CollidedWith, ContactPoint contact) { }
467
468 public virtual PhysicsInertiaData GetInertiaData()
469 {
470 PhysicsInertiaData data = new PhysicsInertiaData();
471 data.TotalMass = this.Mass;
472 data.CenterOfMass = CenterOfMass - Position;
473 data.Inertia = Vector3.Zero;
474 data.InertiaRotation = Vector4.Zero;
475 return data;
476 }
477
478 public virtual void SetInertiaData(PhysicsInertiaData inertia)
479 {
480 }
481
482 public virtual float SimulationSuspended { get; set; }
483
484 // Warning in a parent part it returns itself, not null
485 public virtual PhysicsActor ParentActor { get { return this; } }
486
487
317 // Extendable interface for new, physics engine specific operations 488 // Extendable interface for new, physics engine specific operations
318 public virtual object Extension(string pFunct, params object[] pParams) 489 public virtual object Extension(string pFunct, params object[] pParams)
319 { 490 {
@@ -324,9 +495,11 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
324 495
325 public class NullPhysicsActor : PhysicsActor 496 public class NullPhysicsActor : PhysicsActor
326 { 497 {
498 private ActorTypes m_actorType = ActorTypes.Unknown;
499
327 public override bool Stopped 500 public override bool Stopped
328 { 501 {
329 get{ return false; } 502 get{ return true; }
330 } 503 }
331 504
332 public override Vector3 Position 505 public override Vector3 Position
@@ -343,6 +516,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
343 516
344 public override uint LocalID 517 public override uint LocalID
345 { 518 {
519 get { return 0; }
346 set { return; } 520 set { return; }
347 } 521 }
348 522
@@ -402,50 +576,17 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
402 set { return; } 576 set { return; }
403 } 577 }
404 578
405 public override void VehicleFloatParam(int param, float value) 579 public override void VehicleFloatParam(int param, float value) {}
406 { 580 public override void VehicleVectorParam(int param, Vector3 value) { }
581 public override void VehicleRotationParam(int param, Quaternion rotation) { }
582 public override void VehicleFlags(int param, bool remove) { }
583 public override void SetVolumeDetect(int param) {}
584 public override void SetMaterial(int material) {}
585 public override Vector3 CenterOfMass { get { return Vector3.Zero; }}
407 586
408 } 587 public override Vector3 GeometricCenter { get { return Vector3.Zero; }}
409
410 public override void VehicleVectorParam(int param, Vector3 value)
411 {
412 588
413 } 589 public override PrimitiveBaseShape Shape { set { return; }}
414
415 public override void VehicleRotationParam(int param, Quaternion rotation)
416 {
417
418 }
419
420 public override void VehicleFlags(int param, bool remove)
421 {
422
423 }
424
425 public override void SetVolumeDetect(int param)
426 {
427
428 }
429
430 public override void SetMaterial(int material)
431 {
432
433 }
434
435 public override Vector3 CenterOfMass
436 {
437 get { return Vector3.Zero; }
438 }
439
440 public override Vector3 GeometricCenter
441 {
442 get { return Vector3.Zero; }
443 }
444
445 public override PrimitiveBaseShape Shape
446 {
447 set { return; }
448 }
449 590
450 public override Vector3 Velocity 591 public override Vector3 Velocity
451 { 592 {
@@ -465,9 +606,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
465 set { } 606 set { }
466 } 607 }
467 608
468 public override void CrossingFailure() 609 public override void CrossingFailure() {}
469 {
470 }
471 610
472 public override Quaternion Orientation 611 public override Quaternion Orientation
473 { 612 {
@@ -507,8 +646,20 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
507 646
508 public override int PhysicsActorType 647 public override int PhysicsActorType
509 { 648 {
510 get { return (int) ActorTypes.Unknown; } 649 get { return (int)m_actorType; }
511 set { return; } 650 set {
651 ActorTypes type = (ActorTypes)value;
652 switch (type)
653 {
654 case ActorTypes.Ground:
655 case ActorTypes.Water:
656 m_actorType = type;
657 break;
658 default:
659 m_actorType = ActorTypes.Unknown;
660 break;
661 }
662 }
512 } 663 }
513 664
514 public override bool Kinematic 665 public override bool Kinematic
@@ -517,26 +668,11 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
517 set { return; } 668 set { return; }
518 } 669 }
519 670
520 public override void link(PhysicsActor obj) 671 public override void link(PhysicsActor obj) { }
521 { 672 public override void delink() { }
522 } 673 public override void LockAngularMotion(byte axislocks) { }
523 674 public override void AddForce(Vector3 force, bool pushforce) { }
524 public override void delink() 675 public override void AddAngularForce(Vector3 force, bool pushforce) { }
525 {
526 }
527
528 public override void LockAngularMotion(Vector3 axis)
529 {
530 }
531
532 public override void AddForce(Vector3 force, bool pushforce)
533 {
534 }
535
536 public override void AddAngularForce(Vector3 force, bool pushforce)
537 {
538
539 }
540 676
541 public override Vector3 RotationalVelocity 677 public override Vector3 RotationalVelocity
542 { 678 {
@@ -546,39 +682,28 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
546 682
547 public override Vector3 PIDTarget { set { return; } } 683 public override Vector3 PIDTarget { set { return; } }
548 684
549 public override bool PIDActive 685 public override bool PIDActive
550 { 686 {
551 get { return false; } 687 get { return false; }
552 set { return; } 688 set { return; }
553 } 689 }
554 690
555 public override float PIDTau { set { return; } } 691 public override float PIDTau { set { return; } }
556 692
557 public override float PIDHoverHeight { set { return; } } 693 public override float PIDHoverHeight { set { return; } }
558 public override bool PIDHoverActive { set { return; } } 694 public override bool PIDHoverActive {get {return false;} set { return; } }
559 public override PIDHoverType PIDHoverType { set { return; } } 695 public override PIDHoverType PIDHoverType { set { return; } }
560 public override float PIDHoverTau { set { return; } } 696 public override float PIDHoverTau { set { return; } }
561 697
562 public override Quaternion APIDTarget { set { return; } } 698 public override Quaternion APIDTarget { set { return; } }
563 public override bool APIDActive { set { return; } } 699 public override bool APIDActive { set { return; } }
564 public override float APIDStrength { set { return; } } 700 public override float APIDStrength { set { return; } }
565 public override float APIDDamping { set { return; } } 701 public override float APIDDamping { set { return; } }
566
567 public override void SetMomentum(Vector3 momentum)
568 {
569 }
570
571 public override void SubscribeEvents(int ms)
572 {
573 702
574 } 703 public override void SetMomentum(Vector3 momentum) { }
575 public override void UnSubscribeEvents()
576 {
577 704
578 } 705 public override void SubscribeEvents(int ms) { }
579 public override bool SubscribedEvents() 706 public override void UnSubscribeEvents() { }
580 { 707 public override bool SubscribedEvents() { return false; }
581 return false;
582 }
583 } 708 }
584} 709}
diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs
index 32691fc..e8d6334 100644
--- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs
@@ -41,6 +41,10 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
41 41
42 public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal); 42 public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal);
43 public delegate void RayCallback(List<ContactResult> list); 43 public delegate void RayCallback(List<ContactResult> list);
44 public delegate void ProbeBoxCallback(List<ContactResult> list);
45 public delegate void ProbeSphereCallback(List<ContactResult> list);
46 public delegate void ProbePlaneCallback(List<ContactResult> list);
47 public delegate void SitAvatarCallback(int status, uint partID, Vector3 offset, Quaternion Orientation);
44 48
45 public delegate void JointMoved(PhysicsJoint joint); 49 public delegate void JointMoved(PhysicsJoint joint);
46 public delegate void JointDeactivated(PhysicsJoint joint); 50 public delegate void JointDeactivated(PhysicsJoint joint);
@@ -89,6 +93,8 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
89 public Vector3 Normal; 93 public Vector3 Normal;
90 } 94 }
91 95
96
97
92 public abstract class PhysicsScene 98 public abstract class PhysicsScene
93 { 99 {
94// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 100// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -106,6 +112,8 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
106 /// </summary> 112 /// </summary>
107 public string EngineType { get; protected set; } 113 public string EngineType { get; protected set; }
108 114
115 public string EngineName { get; protected set; }
116
109 // The only thing that should register for this event is the SceneGraph 117 // The only thing that should register for this event is the SceneGraph
110 // Anything else could cause problems. 118 // Anything else could cause problems.
111 public event physicsCrash OnPhysicsCrash; 119 public event physicsCrash OnPhysicsCrash;
@@ -143,6 +151,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
143 /// <param name="size"></param> 151 /// <param name="size"></param>
144 /// <param name="isFlying"></param> 152 /// <param name="isFlying"></param>
145 /// <returns></returns> 153 /// <returns></returns>
154
146 public abstract PhysicsActor AddAvatar( 155 public abstract PhysicsActor AddAvatar(
147 string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying); 156 string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying);
148 157
@@ -161,12 +170,26 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
161 { 170 {
162 PhysicsActor ret = AddAvatar(avName, position, velocity, size, isFlying); 171 PhysicsActor ret = AddAvatar(avName, position, velocity, size, isFlying);
163 172
164 if (ret != null) 173 if (ret != null)
165 ret.LocalID = localID; 174 ret.LocalID = localID;
166 175
167 return ret; 176 return ret;
168 } 177 }
169 178
179 public virtual PhysicsActor AddAvatar(
180 uint localID, string avName, Vector3 position, Vector3 size, bool isFlying)
181 {
182 PhysicsActor ret = AddAvatar(localID, avName, position, Vector3.Zero, size, isFlying);
183 return ret;
184 }
185
186 public virtual PhysicsActor AddAvatar(
187 uint localID, string avName, Vector3 position, Vector3 size, float feetOffset, bool isFlying)
188 {
189 PhysicsActor ret = AddAvatar(localID, avName, position, Vector3.Zero, size, isFlying);
190 return ret;
191 }
192
170 /// <summary> 193 /// <summary>
171 /// Remove an avatar. 194 /// Remove an avatar.
172 /// </summary> 195 /// </summary>
@@ -182,6 +205,19 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
182 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, 205 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
183 Vector3 size, Quaternion rotation, bool isPhysical, uint localid); 206 Vector3 size, Quaternion rotation, bool isPhysical, uint localid);
184 207
208 public virtual PhysicsActor AddPrimShape(string primName, PhysicsActor parent, PrimitiveBaseShape pbs, Vector3 position,
209 uint localid, byte[] sdata)
210 {
211 return null;
212 }
213
214 public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
215 Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, uint localid)
216 {
217 return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid);
218 }
219
220
185 public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, 221 public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
186 Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapetype, uint localid) 222 Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapetype, uint localid)
187 { 223 {
@@ -255,6 +291,9 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
255 291
256 public abstract void AddPhysicsActorTaint(PhysicsActor prim); 292 public abstract void AddPhysicsActorTaint(PhysicsActor prim);
257 293
294
295 public virtual void ProcessPreSimulation() { }
296
258 /// <summary> 297 /// <summary>
259 /// Perform a simulation of the current physics scene over the given timestep. 298 /// Perform a simulation of the current physics scene over the given timestep.
260 /// </summary> 299 /// </summary>
@@ -293,28 +332,19 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
293 return false; 332 return false;
294 } 333 }
295 334
296 public virtual bool SupportsCombining()
297 {
298 return false;
299 }
300
301 public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {}
302
303 public virtual void UnCombine(PhysicsScene pScene) {}
304
305 /// <summary> 335 /// <summary>
306 /// Queue a raycast against the physics scene. 336 /// Queue a raycast against the physics scene.
307 /// The provided callback method will be called when the raycast is complete 337 /// The provided callback method will be called when the raycast is complete
308 /// 338 ///
309 /// Many physics engines don't support collision testing at the same time as 339 /// Many physics engines don't support collision testing at the same time as
310 /// manipulating the physics scene, so we queue the request up and callback 340 /// manipulating the physics scene, so we queue the request up and callback
311 /// a custom method when the raycast is complete. 341 /// a custom method when the raycast is complete.
312 /// This allows physics engines that give an immediate result to callback immediately 342 /// This allows physics engines that give an immediate result to callback immediately
313 /// and ones that don't, to callback when it gets a result back. 343 /// and ones that don't, to callback when it gets a result back.
314 /// 344 ///
315 /// ODE for example will not allow you to change the scene while collision testing or 345 /// ODE for example will not allow you to change the scene while collision testing or
316 /// it asserts, 'opteration not valid for locked space'. This includes adding a ray to the scene. 346 /// it asserts, 'opteration not valid for locked space'. This includes adding a ray to the scene.
317 /// 347 ///
318 /// This is named RayCastWorld to not conflict with modrex's Raycast method. 348 /// This is named RayCastWorld to not conflict with modrex's Raycast method.
319 /// </summary> 349 /// </summary>
320 /// <param name="position">Origin of the ray</param> 350 /// <param name="position">Origin of the ray</param>
@@ -348,6 +378,31 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
348 return false; 378 return false;
349 } 379 }
350 380
381 public virtual List<ContactResult> RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags flags)
382 {
383 return new List<ContactResult>();
384 }
385
386 public virtual List<ContactResult> BoxProbe(Vector3 position, Vector3 size, Quaternion orientation, int Count, RayFilterFlags flags)
387 {
388 return new List<ContactResult>();
389 }
390
391 public virtual List<ContactResult> SphereProbe(Vector3 position, float radius, int Count, RayFilterFlags flags)
392 {
393 return new List<ContactResult>();
394 }
395
396 public virtual List<ContactResult> PlaneProbe(PhysicsActor actor, Vector4 plane, int Count, RayFilterFlags flags)
397 {
398 return new List<ContactResult>();
399 }
400
401 public virtual int SitAvatar(PhysicsActor actor, Vector3 AbsolutePosition, Vector3 CameraPosition, Vector3 offset, Vector3 AvatarSize, SitAvatarCallback PhysicsSitResponse)
402 {
403 return 0;
404 }
405
351 // Extendable interface for new, physics engine specific operations 406 // Extendable interface for new, physics engine specific operations
352 public virtual object Extension(string pFunct, params object[] pParams) 407 public virtual object Extension(string pFunct, params object[] pParams)
353 { 408 {
diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs
index 76a82fa..5aae42f 100644
--- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
49 public Vector3(Vector3 pv) : this(pv.X, pv.Y, pv.Z) 49 public Vector3(Vector3 pv) : this(pv.X, pv.Y, pv.Z)
50 { 50 {
51 } 51 }
52 52
53 public void setValues(float x, float y, float z) 53 public void setValues(float x, float y, float z)
54 { 54 {
55 X = x; 55 X = x;
diff --git a/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs b/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs
index 63a8cb8..0b4c8c6 100644
--- a/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using OpenMetaverse;
29 30
30namespace OpenSim.Region.PhysicsModules.SharedBase 31namespace OpenSim.Region.PhysicsModules.SharedBase
31{ 32{
@@ -37,7 +38,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
37 TYPE_NONE = 0, 38 TYPE_NONE = 0,
38 39
39 /// <summary> 40 /// <summary>
40 /// No Angular motor, High Left right friction, No Hover, Linear Deflection 1, no angular deflection 41 /// No Angular motor, High Left right friction, No Hover, Linear Deflection 1, no angular deflection
41 /// no vertical attractor, No banking, Identity rotation frame 42 /// no vertical attractor, No banking, Identity rotation frame
42 /// </summary> 43 /// </summary>
43 TYPE_SLED = 1, 44 TYPE_SLED = 1,
@@ -117,5 +118,47 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
117 NO_DEFLECTION = 16392, 118 NO_DEFLECTION = 16392,
118 LOCK_ROTATION = 32784 119 LOCK_ROTATION = 32784
119 } 120 }
120 121
122 public struct VehicleData
123 {
124 public Vehicle m_type;
125 public VehicleFlag m_flags;
126
127 // Linear properties
128 public Vector3 m_linearMotorDirection;
129 public Vector3 m_linearFrictionTimescale;
130 public float m_linearMotorDecayTimescale;
131 public float m_linearMotorTimescale;
132 public Vector3 m_linearMotorOffset;
133
134 //Angular properties
135 public Vector3 m_angularMotorDirection;
136 public float m_angularMotorTimescale;
137 public float m_angularMotorDecayTimescale;
138 public Vector3 m_angularFrictionTimescale;
139
140 //Deflection properties
141 public float m_angularDeflectionEfficiency;
142 public float m_angularDeflectionTimescale;
143 public float m_linearDeflectionEfficiency;
144 public float m_linearDeflectionTimescale;
145
146 //Banking properties
147 public float m_bankingEfficiency;
148 public float m_bankingMix;
149 public float m_bankingTimescale;
150
151 //Hover and Buoyancy properties
152 public float m_VhoverHeight;
153 public float m_VhoverEfficiency;
154 public float m_VhoverTimescale;
155 public float m_VehicleBuoyancy;
156
157 //Attractor properties
158 public float m_verticalAttractionEfficiency;
159 public float m_verticalAttractionTimescale;
160
161 // Axis
162 public Quaternion m_referenceFrame;
163 }
121} 164}