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.cs89
1 files changed, 86 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 488900e..a442cf0 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -38,11 +38,40 @@ 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 SitAvatarCallback(int status, uint partID, Vector3 offset, Quaternion Orientation);
41 42
42 public delegate void JointMoved(PhysicsJoint joint); 43 public delegate void JointMoved(PhysicsJoint joint);
43 public delegate void JointDeactivated(PhysicsJoint joint); 44 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" 45 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 46
47 public enum RayFilterFlags:ushort
48 {
49 // the flags
50 water = 0x01,
51 land = 0x02,
52 agent = 0x04,
53 nonphysical = 0x08,
54 physical = 0x10,
55 phantom = 0x20,
56 volumedtc = 0x40,
57
58 // ray cast colision control (may only work for meshs)
59 BackFaceCull = 0x4000,
60 ClosestHit = 0x8000,
61
62 // some combinations
63 LSLPhanton = phantom | volumedtc,
64 PrimsNonPhantom = nonphysical | physical,
65 PrimsNonPhantomAgents = nonphysical | physical | agent,
66
67 AllPrims = nonphysical | phantom | volumedtc | physical,
68 AllButLand = agent | nonphysical | physical | phantom | volumedtc,
69
70 ClosestAndBackCull = ClosestHit | BackFaceCull,
71
72 All = 0x3f
73 }
74
46 public delegate void RequestAssetDelegate(UUID assetID, AssetReceivedDelegate callback); 75 public delegate void RequestAssetDelegate(UUID assetID, AssetReceivedDelegate callback);
47 public delegate void AssetReceivedDelegate(AssetBase asset); 76 public delegate void AssetReceivedDelegate(AssetBase asset);
48 77
@@ -57,6 +86,8 @@ namespace OpenSim.Region.Physics.Manager
57 public Vector3 Normal; 86 public Vector3 Normal;
58 } 87 }
59 88
89
90
60 public abstract class PhysicsScene 91 public abstract class PhysicsScene
61 { 92 {
62// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 93// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -97,8 +128,10 @@ namespace OpenSim.Region.Physics.Manager
97 /// <param name="size"></param> 128 /// <param name="size"></param>
98 /// <param name="isFlying"></param> 129 /// <param name="isFlying"></param>
99 /// <returns></returns> 130 /// <returns></returns>
100 public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying); 131 public virtual PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
101 132 {
133 return null;
134 }
102 /// <summary> 135 /// <summary>
103 /// Add an avatar 136 /// Add an avatar
104 /// </summary> 137 /// </summary>
@@ -115,6 +148,12 @@ namespace OpenSim.Region.Physics.Manager
115 return ret; 148 return ret;
116 } 149 }
117 150
151 public virtual PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, float feetOffset, bool isFlying)
152 {
153 PhysicsActor ret = AddAvatar(localID, avName, position, size, isFlying);
154 return ret;
155 }
156
118 /// <summary> 157 /// <summary>
119 /// Remove an avatar. 158 /// Remove an avatar.
120 /// </summary> 159 /// </summary>
@@ -130,6 +169,25 @@ namespace OpenSim.Region.Physics.Manager
130 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, 169 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
131 Vector3 size, Quaternion rotation, bool isPhysical, uint localid); 170 Vector3 size, Quaternion rotation, bool isPhysical, uint localid);
132 171
172 public virtual PhysicsActor AddPrimShape(string primName, PhysicsActor parent, PrimitiveBaseShape pbs, Vector3 position,
173 uint localid, byte[] sdata)
174 {
175 return null;
176 }
177
178 public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
179 Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, uint localid)
180 {
181 return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid);
182 }
183
184
185 public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
186 Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapetype, uint localid)
187 {
188 return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid);
189 }
190
133 public virtual float TimeDilation 191 public virtual float TimeDilation
134 { 192 {
135 get { return 1.0f; } 193 get { return 1.0f; }
@@ -197,6 +255,9 @@ namespace OpenSim.Region.Physics.Manager
197 255
198 public abstract void AddPhysicsActorTaint(PhysicsActor prim); 256 public abstract void AddPhysicsActorTaint(PhysicsActor prim);
199 257
258
259 public virtual void PrepareSimulation() { }
260
200 /// <summary> 261 /// <summary>
201 /// Perform a simulation of the current physics scene over the given timestep. 262 /// Perform a simulation of the current physics scene over the given timestep.
202 /// </summary> 263 /// </summary>
@@ -241,7 +302,7 @@ namespace OpenSim.Region.Physics.Manager
241 } 302 }
242 303
243 public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {} 304 public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {}
244 305 public virtual void CombineTerrain(float[] heightMap, Vector3 pOffset) {}
245 public virtual void UnCombine(PhysicsScene pScene) {} 306 public virtual void UnCombine(PhysicsScene pScene) {}
246 307
247 /// <summary> 308 /// <summary>
@@ -279,5 +340,27 @@ namespace OpenSim.Region.Physics.Manager
279 { 340 {
280 return new List<ContactResult>(); 341 return new List<ContactResult>();
281 } 342 }
343
344 public virtual object RaycastWorld(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter)
345 {
346 return null;
347 }
348
349 public virtual bool SuportsRaycastWorldFiltered()
350 {
351 return false;
352 }
353
354 public virtual void RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, RaycastCallback retMethod){}
355 public virtual void RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count, RayCallback retMethod) { }
356 public virtual List<ContactResult> RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count)
357 {
358 return new List<ContactResult>();
359 }
360
361 public virtual int SitAvatar(PhysicsActor actor, Vector3 AbsolutePosition, Vector3 CameraPosition, Vector3 offset, Vector3 AvatarSize, SitAvatarCallback PhysicsSitResponse)
362 {
363 return 0;
364 }
282 } 365 }
283} 366}