aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Manager/PhysicsScene.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs117
1 files changed, 112 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 488900e..f82b597 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -38,11 +38,44 @@ namespace OpenSim.Region.Physics.Manager
38 38
39 public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal); 39 public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal);
40 public delegate void RayCallback(List<ContactResult> list); 40 public delegate void RayCallback(List<ContactResult> list);
41 public delegate void ProbeBoxCallback(List<ContactResult> list);
42 public delegate void ProbeSphereCallback(List<ContactResult> list);
43 public delegate void ProbePlaneCallback(List<ContactResult> list);
44 public delegate void SitAvatarCallback(int status, uint partID, Vector3 offset, Quaternion Orientation);
41 45
42 public delegate void JointMoved(PhysicsJoint joint); 46 public delegate void JointMoved(PhysicsJoint joint);
43 public delegate void JointDeactivated(PhysicsJoint joint); 47 public delegate void JointDeactivated(PhysicsJoint joint);
44 public delegate void JointErrorMessage(PhysicsJoint joint, string message); // this refers to an "error message due to a problem", not "amount of joint constraint violation" 48 public delegate void JointErrorMessage(PhysicsJoint joint, string message); // this refers to an "error message due to a problem", not "amount of joint constraint violation"
45 49
50 public enum RayFilterFlags:ushort
51 {
52 // the flags
53 water = 0x01,
54 land = 0x02,
55 agent = 0x04,
56 nonphysical = 0x08,
57 physical = 0x10,
58 phantom = 0x20,
59 volumedtc = 0x40,
60
61 // ray cast colision control (may only work for meshs)
62 ContactsUnImportant = 0x2000,
63 BackFaceCull = 0x4000,
64 ClosestHit = 0x8000,
65
66 // some combinations
67 LSLPhanton = phantom | volumedtc,
68 PrimsNonPhantom = nonphysical | physical,
69 PrimsNonPhantomAgents = nonphysical | physical | agent,
70
71 AllPrims = nonphysical | phantom | volumedtc | physical,
72 AllButLand = agent | nonphysical | physical | phantom | volumedtc,
73
74 ClosestAndBackCull = ClosestHit | BackFaceCull,
75
76 All = 0x3f
77 }
78
46 public delegate void RequestAssetDelegate(UUID assetID, AssetReceivedDelegate callback); 79 public delegate void RequestAssetDelegate(UUID assetID, AssetReceivedDelegate callback);
47 public delegate void AssetReceivedDelegate(AssetBase asset); 80 public delegate void AssetReceivedDelegate(AssetBase asset);
48 81
@@ -57,18 +90,27 @@ namespace OpenSim.Region.Physics.Manager
57 public Vector3 Normal; 90 public Vector3 Normal;
58 } 91 }
59 92
93
94
60 public abstract class PhysicsScene 95 public abstract class PhysicsScene
61 { 96 {
62// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 97// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
63 98
64 /// <summary> 99 /// <summary>
65 /// Name of this scene. Useful in debug messages to distinguish one OdeScene instance from another. 100 /// A unique identifying string for this instance of the physics engine.
101 /// Useful in debug messages to distinguish one OdeScene instance from another.
102 /// Usually set to include the region name that the physics engine is acting for.
66 /// </summary> 103 /// </summary>
67 public string Name { get; protected set; } 104 public string Name { get; protected set; }
68 105
106 /// <summary>
107 /// A string identifying the family of this physics engine. Most common values returned
108 /// are "OpenDynamicsEngine" and "BulletSim" but others are possible.
109 /// </summary>
110 public string EngineType { get; protected set; }
111
69 // The only thing that should register for this event is the SceneGraph 112 // The only thing that should register for this event is the SceneGraph
70 // Anything else could cause problems. 113 // Anything else could cause problems.
71
72 public event physicsCrash OnPhysicsCrash; 114 public event physicsCrash OnPhysicsCrash;
73 115
74 public static PhysicsScene Null 116 public static PhysicsScene Null
@@ -97,8 +139,10 @@ namespace OpenSim.Region.Physics.Manager
97 /// <param name="size"></param> 139 /// <param name="size"></param>
98 /// <param name="isFlying"></param> 140 /// <param name="isFlying"></param>
99 /// <returns></returns> 141 /// <returns></returns>
100 public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying); 142 public virtual PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
101 143 {
144 return null;
145 }
102 /// <summary> 146 /// <summary>
103 /// Add an avatar 147 /// Add an avatar
104 /// </summary> 148 /// </summary>
@@ -115,6 +159,12 @@ namespace OpenSim.Region.Physics.Manager
115 return ret; 159 return ret;
116 } 160 }
117 161
162 public virtual PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, float feetOffset, bool isFlying)
163 {
164 PhysicsActor ret = AddAvatar(localID, avName, position, size, isFlying);
165 return ret;
166 }
167
118 /// <summary> 168 /// <summary>
119 /// Remove an avatar. 169 /// Remove an avatar.
120 /// </summary> 170 /// </summary>
@@ -130,6 +180,25 @@ namespace OpenSim.Region.Physics.Manager
130 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, 180 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
131 Vector3 size, Quaternion rotation, bool isPhysical, uint localid); 181 Vector3 size, Quaternion rotation, bool isPhysical, uint localid);
132 182
183 public virtual PhysicsActor AddPrimShape(string primName, PhysicsActor parent, PrimitiveBaseShape pbs, Vector3 position,
184 uint localid, byte[] sdata)
185 {
186 return null;
187 }
188
189 public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
190 Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, uint localid)
191 {
192 return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid);
193 }
194
195
196 public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
197 Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapetype, uint localid)
198 {
199 return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid);
200 }
201
133 public virtual float TimeDilation 202 public virtual float TimeDilation
134 { 203 {
135 get { return 1.0f; } 204 get { return 1.0f; }
@@ -197,6 +266,9 @@ namespace OpenSim.Region.Physics.Manager
197 266
198 public abstract void AddPhysicsActorTaint(PhysicsActor prim); 267 public abstract void AddPhysicsActorTaint(PhysicsActor prim);
199 268
269
270 public virtual void PrepareSimulation() { }
271
200 /// <summary> 272 /// <summary>
201 /// Perform a simulation of the current physics scene over the given timestep. 273 /// Perform a simulation of the current physics scene over the given timestep.
202 /// </summary> 274 /// </summary>
@@ -241,7 +313,7 @@ namespace OpenSim.Region.Physics.Manager
241 } 313 }
242 314
243 public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {} 315 public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {}
244 316 public virtual void CombineTerrain(float[] heightMap, Vector3 pOffset) {}
245 public virtual void UnCombine(PhysicsScene pScene) {} 317 public virtual void UnCombine(PhysicsScene pScene) {}
246 318
247 /// <summary> 319 /// <summary>
@@ -279,5 +351,40 @@ namespace OpenSim.Region.Physics.Manager
279 { 351 {
280 return new List<ContactResult>(); 352 return new List<ContactResult>();
281 } 353 }
354
355 public virtual object RaycastWorld(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter)
356 {
357 return null;
358 }
359
360 public virtual bool SuportsRaycastWorldFiltered()
361 {
362 return false;
363 }
364
365 public virtual List<ContactResult> RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags flags)
366 {
367 return new List<ContactResult>();
368 }
369
370 public virtual List<ContactResult> BoxProbe(Vector3 position, Vector3 size, Quaternion orientation, int Count, RayFilterFlags flags)
371 {
372 return new List<ContactResult>();
373 }
374
375 public virtual List<ContactResult> SphereProbe(Vector3 position, float radius, int Count, RayFilterFlags flags)
376 {
377 return new List<ContactResult>();
378 }
379
380 public virtual List<ContactResult> PlaneProbe(PhysicsActor actor, Vector4 plane, int Count, RayFilterFlags flags)
381 {
382 return new List<ContactResult>();
383 }
384
385 public virtual int SitAvatar(PhysicsActor actor, Vector3 AbsolutePosition, Vector3 CameraPosition, Vector3 offset, Vector3 AvatarSize, SitAvatarCallback PhysicsSitResponse)
386 {
387 return 0;
388 }
282 } 389 }
283} 390}