From 08819bcbea9012d67cc4cb44e4d7ec7e5837bac6 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 19 Jul 2009 02:32:02 +0000 Subject: * Created a way that the OpenSimulator scene can ask the physics scene to do a raycast test safely. * Test for prim obstructions between the avatar and camera. If there are obstructions, inform the client to move the camera closer. This makes it so that walls and objects don't obstruct your view while you're moving around. Try walking inside a hollowed tori. You'll see how much easier it is now because your camera automatically moves closer so you can still see. * Created a way to know if the user's camera is alt + cammed or just following the avatar. * Changes IClientAPI interface by adding SendCameraConstraint(Vector4 CameraConstraint) --- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs') diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 889afb6..87357a3 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -306,6 +306,8 @@ namespace OpenSim.Region.Physics.OdePlugin private volatile int m_global_contactcount = 0; + private ODERayCastRequestManager m_rayCastManager; + /// /// Initiailizes the scene /// Sets many properties that ODE requires to be stable @@ -321,7 +323,7 @@ namespace OpenSim.Region.Physics.OdePlugin nearCallback = near; triCallback = TriCallback; triArrayCallback = TriArrayCallback; - + m_rayCastManager = new ODERayCastRequestManager(this); lock (OdeLock) { // Create the world and the first space @@ -2833,6 +2835,8 @@ namespace OpenSim.Region.Physics.OdePlugin //if ((framecount % m_randomizeWater) == 0) // randomizeWater(waterlevel); + int RayCastTimeMS = m_rayCastManager.ProcessQueuedRequests(); + collision_optimized(timeStep); lock (_collisionEventPrim) @@ -3377,6 +3381,9 @@ namespace OpenSim.Region.Physics.OdePlugin public override void Dispose() { + m_rayCastManager.Dispose(); + m_rayCastManager = null; + lock (OdeLock) { lock (_prims) @@ -3417,6 +3424,20 @@ namespace OpenSim.Region.Physics.OdePlugin } return returncolliders; } + + public override bool SupportsRayCast() + { + return true; + } + + public override void RaycastWorld(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod) + { + if (retMethod != null) + { + m_rayCastManager.QueueRequest(position, direction, length, retMethod); + } + } + #if USE_DRAWSTUFF // Keyboard callback public void command(int cmd) -- cgit v1.1