aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Manager/PhysicsScene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/Manager/PhysicsScene.cs')
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs106
1 files changed, 103 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 201007b..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,6 +90,8 @@ 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);
@@ -104,8 +139,10 @@ namespace OpenSim.Region.Physics.Manager
104 /// <param name="size"></param> 139 /// <param name="size"></param>
105 /// <param name="isFlying"></param> 140 /// <param name="isFlying"></param>
106 /// <returns></returns> 141 /// <returns></returns>
107 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)
108 143 {
144 return null;
145 }
109 /// <summary> 146 /// <summary>
110 /// Add an avatar 147 /// Add an avatar
111 /// </summary> 148 /// </summary>
@@ -122,6 +159,12 @@ namespace OpenSim.Region.Physics.Manager
122 return ret; 159 return ret;
123 } 160 }
124 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
125 /// <summary> 168 /// <summary>
126 /// Remove an avatar. 169 /// Remove an avatar.
127 /// </summary> 170 /// </summary>
@@ -137,6 +180,25 @@ namespace OpenSim.Region.Physics.Manager
137 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, 180 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
138 Vector3 size, Quaternion rotation, bool isPhysical, uint localid); 181 Vector3 size, Quaternion rotation, bool isPhysical, uint localid);
139 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
140 public virtual float TimeDilation 202 public virtual float TimeDilation
141 { 203 {
142 get { return 1.0f; } 204 get { return 1.0f; }
@@ -204,6 +266,9 @@ namespace OpenSim.Region.Physics.Manager
204 266
205 public abstract void AddPhysicsActorTaint(PhysicsActor prim); 267 public abstract void AddPhysicsActorTaint(PhysicsActor prim);
206 268
269
270 public virtual void PrepareSimulation() { }
271
207 /// <summary> 272 /// <summary>
208 /// 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.
209 /// </summary> 274 /// </summary>
@@ -248,7 +313,7 @@ namespace OpenSim.Region.Physics.Manager
248 } 313 }
249 314
250 public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {} 315 public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {}
251 316 public virtual void CombineTerrain(float[] heightMap, Vector3 pOffset) {}
252 public virtual void UnCombine(PhysicsScene pScene) {} 317 public virtual void UnCombine(PhysicsScene pScene) {}
253 318
254 /// <summary> 319 /// <summary>
@@ -286,5 +351,40 @@ namespace OpenSim.Region.Physics.Manager
286 { 351 {
287 return new List<ContactResult>(); 352 return new List<ContactResult>();
288 } 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 }
289 } 389 }
290} 390}