aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Manager
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/Manager')
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 410707b..95699fb 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -36,6 +36,8 @@ namespace OpenSim.Region.Physics.Manager
36{ 36{
37 public delegate void physicsCrash(); 37 public delegate void physicsCrash();
38 38
39 public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance);
40
39 public abstract class PhysicsScene 41 public abstract class PhysicsScene
40 { 42 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -152,6 +154,39 @@ namespace OpenSim.Region.Physics.Manager
152 154
153 public abstract bool IsThreaded { get; } 155 public abstract bool IsThreaded { get; }
154 156
157 /// <summary>
158 /// True if the physics plugin supports raycasting against the physics scene
159 /// </summary>
160 public virtual bool SupportsRayCast()
161 {
162 return false;
163 }
164
165 /// <summary>
166 /// Queue a raycast against the physics scene.
167 /// The provided callback method will be called when the raycast is complete
168 ///
169 /// Many physics engines don't support collision testing at the same time as
170 /// manipulating the physics scene, so we queue the request up and callback
171 /// a custom method when the raycast is complete.
172 /// This allows physics engines that give an immediate result to callback immediately
173 /// and ones that don't, to callback when it gets a result back.
174 ///
175 /// ODE for example will not allow you to change the scene while collision testing or
176 /// it asserts, 'opteration not valid for locked space'. This includes adding a ray to the scene.
177 ///
178 /// This is named RayCastWorld to not conflict with modrex's Raycast method.
179 /// </summary>
180 /// <param name="position">Origin of the ray</param>
181 /// <param name="direction">Direction of the ray</param>
182 /// <param name="length">Length of ray in meters</param>
183 /// <param name="retMethod">Method to call when the raycast is complete</param>
184 public virtual void RaycastWorld( Vector3 position, Vector3 direction, float length, RaycastCallback retMethod)
185 {
186 if (retMethod != null)
187 retMethod(false, Vector3.Zero, 0, 999999999999f);
188 }
189
155 private class NullPhysicsScene : PhysicsScene 190 private class NullPhysicsScene : PhysicsScene
156 { 191 {
157 private static int m_workIndicator; 192 private static int m_workIndicator;
@@ -240,6 +275,7 @@ namespace OpenSim.Region.Physics.Manager
240 Dictionary<uint, float> returncolliders = new Dictionary<uint, float>(); 275 Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
241 return returncolliders; 276 return returncolliders;
242 } 277 }
278
243 } 279 }
244 } 280 }
245 public delegate void JointMoved(PhysicsJoint joint); 281 public delegate void JointMoved(PhysicsJoint joint);