From df0e5cc9fe9b0851ae5442bdeeb49ab7778d5fe1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 12 Jul 2011 02:33:09 +0100 Subject: When a mesh object is added to a scene, delay adding the physics actor until the sculpt data has been added to the shape (possibly via an async asset service request) This prevents spurious 'no asset data' for meshes added on startup. --- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 21 +++++++++--------- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 33 +++++++++++++++------------- 2 files changed, 29 insertions(+), 25 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 123c8ff..56e3b7e 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -638,7 +638,7 @@ namespace OpenSim.Region.Physics.OdePlugin float profileEnd; if (_pbs.PathCurve == (byte)Extrusion.Straight || _pbs.PathCurve == (byte)Extrusion.Flexible) - { + { taperX1 = _pbs.PathScaleX * 0.01f; if (taperX1 > 1.0f) taperX1 = 2.0f - taperX1; @@ -648,9 +648,9 @@ namespace OpenSim.Region.Physics.OdePlugin if (taperY1 > 1.0f) taperY1 = 2.0f - taperY1; taperY = 1.0f - taperY1; - } + } else - { + { taperX = _pbs.PathTaperX * 0.01f; if (taperX < 0.0f) taperX = -taperX; @@ -660,9 +660,7 @@ namespace OpenSim.Region.Physics.OdePlugin if (taperY < 0.0f) taperY = -taperY; taperY1 = 1.0f - taperY; - - } - + } volume *= (taperX1 * taperY1 + 0.5f * (taperX1 * taperY + taperX * taperY1) + 0.3333333333f * taperX * taperY); @@ -859,7 +857,9 @@ namespace OpenSim.Region.Physics.OdePlugin public void ProcessTaints(float timestep) { -//Console.WriteLine("ProcessTaints for " + Name); +#if SPAM +Console.WriteLine("ZProcessTaints for " + Name); +#endif if (m_taintadd) { changeadd(timestep); @@ -1323,7 +1323,9 @@ namespace OpenSim.Region.Physics.OdePlugin public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh) { -//Console.WriteLine("CreateGeom:"); +#if SPAM +Console.WriteLine("CreateGeom:"); +#endif if (_mesh != null) { setMesh(_parent_scene, _mesh); @@ -1944,7 +1946,6 @@ Console.WriteLine(" JointCreateFixed"); if (_parent_scene.needsMeshing(_pbs)) mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); - //IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); #if SPAM Console.WriteLine("changesize 1"); #endif @@ -2056,8 +2057,8 @@ Console.WriteLine("changesize 2"); if (IsPhysical) meshlod = _parent_scene.MeshSculptphysicalLOD; - IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); // createmesh returns null when it doesn't mesh. + IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); #if SPAM Console.WriteLine("changeshape needed meshing"); #endif diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 99392cc..7b8a80c 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -1723,20 +1723,21 @@ namespace OpenSim.Region.Physics.OdePlugin PhysicsActor result; IMesh mesh = null; - if (needsMeshing(pbs)) - { - try - { - mesh = mesher.CreateMesh(primName, pbs, size, 32f, isPhysical); - } - catch(Exception e) - { - m_log.ErrorFormat("[PHYSICS]: Exception while meshing prim {0}.", primName); - m_log.Debug(e.ToString()); - mesh = null; - return null; - } - } + // Don't create the mesh here - wait until the mesh data is loaded from the asset store. +// if (needsMeshing(pbs)) +// { +// try +// { +// mesh = mesher.CreateMesh(primName, pbs, size, 32f, isPhysical); +// } +// catch(Exception e) +// { +// m_log.ErrorFormat("[PHYSICS]: Exception while meshing prim {0}.", primName); +// m_log.Debug(e.ToString()); +// mesh = null; +// return null; +// } +// } result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical); @@ -2590,7 +2591,9 @@ namespace OpenSim.Region.Physics.OdePlugin { if (!(_taintedPrimH.Contains(taintedprim))) { -//Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.m_primName); +#if SPAM +Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); +#endif _taintedPrimH.Add(taintedprim); // HashSet for searching _taintedPrimL.Add(taintedprim); // List for ordered readout } -- cgit v1.1 From f75f906e3560b076105ab9551263617e084d6393 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 12 Jul 2011 03:13:05 +0100 Subject: minor: remove whitespace to trigger another build --- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 56e3b7e..27bf942 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -844,7 +844,6 @@ namespace OpenSim.Region.Physics.OdePlugin return; } - // if (IsPhysical && Body == (IntPtr) 0) // { // Recreate the body -- cgit v1.1 From d31e0a67f7d7c2b1882a2030fe01d5d2ee32ad2a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 12 Jul 2011 03:26:22 +0100 Subject: temporarily fix the build break with building the OdePlugin tests assembly. This needs to be fixed properly. --- OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs index a7f8baa..fbd1574 100644 --- a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs +++ b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs @@ -31,17 +31,18 @@ using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Physics.Manager; +using OpenSim.Region.Physics.OdePlugin; using log4net; using System.Reflection; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.Physics.OdePlugin.Tests { [TestFixture] public class ODETestClass { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private OdePlugin cbt; + private OpenSim.Region.Physics.OdePlugin.OdePlugin cbt; private PhysicsScene ps; private IMeshingPlugin imp; -- cgit v1.1 From 3e456163dd284fa04ab17465041a1a27f7b632b9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 12 Jul 2011 22:13:15 +0100 Subject: Port implementation of llCastRay() from Aurora. I haven't been able to test this since the viewer won't parse the llCastRay() function. Maybe some activation cap is missing. Could wait until it is activated by default in the viewer. --- OpenSim/Region/Physics/Manager/PhysicsScene.cs | 24 +++++- .../Physics/OdePlugin/ODERayCastRequestManager.cs | 92 ++++++++++++++++++---- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 28 +++++++ 3 files changed, 126 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 13ea084..0de4626 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs @@ -37,6 +37,18 @@ namespace OpenSim.Region.Physics.Manager public delegate void physicsCrash(); public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal); + public delegate void RayCallback(List list); + + /// + /// Contact result from a raycast. + /// + public struct ContactResult + { + public Vector3 Pos; + public float Depth; + public uint ConsumerID; + public Vector3 Normal; + } public abstract class PhysicsScene { @@ -61,7 +73,6 @@ namespace OpenSim.Region.Physics.Manager } } - public abstract void Initialise(IMesher meshmerizer, IConfigSource config); public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying); @@ -225,6 +236,17 @@ namespace OpenSim.Region.Physics.Manager retMethod(false, Vector3.Zero, 0, 999999999999f, Vector3.Zero); } + public virtual void RaycastWorld(Vector3 position, Vector3 direction, float length, int Count, RayCallback retMethod) + { + if (retMethod != null) + retMethod(new List()); + } + + public virtual List RaycastWorld(Vector3 position, Vector3 direction, float length, int Count) + { + return new List(); + } + private class NullPhysicsScene : PhysicsScene { private static int m_workIndicator; diff --git a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs index ba77dae..6c2bdde 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs @@ -45,11 +45,16 @@ namespace OpenSim.Region.Physics.OdePlugin public class ODERayCastRequestManager { /// - /// Pending Raycast Requests + /// Pending raycast requests /// protected List m_PendingRequests = new List(); /// + /// Pending ray requests + /// + protected List m_PendingRayRequests = new List(); + + /// /// Scene that created this object. /// private OdeScene m_scene; @@ -96,6 +101,29 @@ namespace OpenSim.Region.Physics.OdePlugin } /// + /// Queues a raycast + /// + /// Origin of Ray + /// Ray normal + /// Ray length + /// + /// Return method to send the results + public void QueueRequest(Vector3 position, Vector3 direction, float length, int count, RayCallback retMethod) + { + lock (m_PendingRequests) + { + ODERayRequest req = new ODERayRequest(); + req.callbackMethod = retMethod; + req.length = length; + req.Normal = direction; + req.Origin = position; + req.Count = count; + + m_PendingRayRequests.Add(req); + } + } + + /// /// Process all queued raycast requests /// /// Time in MS the raycasts took to process. @@ -112,15 +140,23 @@ namespace OpenSim.Region.Physics.OdePlugin if (reqs[i].callbackMethod != null) // quick optimization here, don't raycast RayCast(reqs[i]); // if there isn't anyone to send results } - /* - foreach (ODERayCastRequest req in m_PendingRequests) + + m_PendingRequests.Clear(); + } + } + + lock (m_PendingRayRequests) + { + if (m_PendingRayRequests.Count > 0) + { + ODERayRequest[] reqs = m_PendingRayRequests.ToArray(); + for (int i = 0; i < reqs.Length; i++) { - if (req.callbackMethod != null) // quick optimization here, don't raycast - RayCast(req); // if there isn't anyone to send results to - + if (reqs[i].callbackMethod != null) // quick optimization here, don't raycast + RayCast(reqs[i]); // if there isn't anyone to send results } - */ - m_PendingRequests.Clear(); + + m_PendingRayRequests.Clear(); } } @@ -146,7 +182,6 @@ namespace OpenSim.Region.Physics.OdePlugin // Remove Ray d.GeomDestroy(ray); - // Define default results bool hitYN = false; uint hitConsumerID = 0; @@ -177,6 +212,31 @@ namespace OpenSim.Region.Physics.OdePlugin req.callbackMethod(hitYN, closestcontact, hitConsumerID, distance, snormal); } + /// + /// Method that actually initiates the raycast + /// + /// + private void RayCast(ODERayRequest req) + { + // Create the ray + IntPtr ray = d.CreateRay(m_scene.space, req.length); + d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); + + // Collide test + d.SpaceCollide2(m_scene.space, ray, IntPtr.Zero, nearCallback); + + // Remove Ray + d.GeomDestroy(ray); + + // Find closest contact and object. + lock (m_contactResults) + { + // Return results + if (req.callbackMethod != null) + req.callbackMethod(m_contactResults); + } + } + // This is the standard Near. Uses space AABBs to speed up detection. private void near(IntPtr space, IntPtr g1, IntPtr g2) { @@ -342,10 +402,7 @@ namespace OpenSim.Region.Physics.OdePlugin m_contactResults.Add(collisionresult); } } - - } - } /// @@ -365,11 +422,12 @@ namespace OpenSim.Region.Physics.OdePlugin public RaycastCallback callbackMethod; } - public struct ContactResult + public struct ODERayRequest { - public Vector3 Pos; - public float Depth; - public uint ConsumerID; + public Vector3 Origin; public Vector3 Normal; + public int Count; + public float length; + public RayCallback callbackMethod; } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 7b8a80c..ba8cba4 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -3736,6 +3736,34 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); } } + public override void RaycastWorld(Vector3 position, Vector3 direction, float length, int Count, RayCallback retMethod) + { + if (retMethod != null) + { + m_rayCastManager.QueueRequest(position, direction, length, Count, retMethod); + } + } + + public override List RaycastWorld(Vector3 position, Vector3 direction, float length, int Count) + { + ContactResult[] ourResults = null; + RayCallback retMethod = delegate(List results) + { + ourResults = new ContactResult[results.Count]; + results.CopyTo(ourResults, 0); + }; + int waitTime = 0; + m_rayCastManager.QueueRequest(position, direction, length, Count, retMethod); + while (ourResults == null && waitTime < 1000) + { + Thread.Sleep(1); + waitTime++; + } + if (ourResults == null) + return new List (); + return new List(ourResults); + } + #if USE_DRAWSTUFF // Keyboard callback public void command(int cmd) -- cgit v1.1 From e9dbe54ab1217e4310b0e7e014516363237e2a21 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 15 Jul 2011 20:07:59 +0100 Subject: Fix some local id issues in physics glue --- .../Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs | 8 +------- .../Physics/BulletDotNETPlugin/BulletDotNETScene.cs | 7 +------ OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | 8 +------- OpenSim/Region/Physics/Manager/PhysicsScene.cs | 19 +++++++------------ OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 8 +------- .../Region/Physics/OdePlugin/Tests/ODETestClass.cs | 2 +- OpenSim/Region/Physics/POSPlugin/POSScene.cs | 8 +------- OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs | 8 +------- 8 files changed, 14 insertions(+), 54 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs index b6e1cb4..6c9d9ab 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs @@ -84,13 +84,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin */ public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation) - { - return AddPrimShape(primName, pbs, position, size, rotation, false); - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical) + Vector3 size, Quaternion rotation, bool isPhysical, uint localid) { return null; } diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs index 6df213d..0d1bd82 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs @@ -213,12 +213,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin return newPrim; } - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation) - { - return AddPrimShape(primName, pbs, position, size, rotation, false); - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation, bool isPhysical) + public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation, bool isPhysical, uint localid) { PhysicsActor result; IMesh mesh = null; diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index e2a6a2e..df62dbc 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs @@ -626,13 +626,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin } public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position, - OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation) - { - return AddPrimShape(primName, pbs, position, size, rotation, false); - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position, - OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation, bool isPhysical) + OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation, bool isPhysical, uint localid) { PhysicsActor result; diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 0de4626..28ace34 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs @@ -88,15 +88,16 @@ namespace OpenSim.Region.Physics.Manager public abstract void RemovePrim(PhysicsActor prim); + //public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, + // Vector3 size, Quaternion rotation); //To be removed - Actually removed! + public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation); //To be removed - public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical); + Vector3 size, Quaternion rotation, bool isPhysical, uint localid); public virtual PhysicsActor AddPrimShape(uint localID, string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical) + Vector3 size, Quaternion rotation, bool isPhysical, uint localid) { - PhysicsActor ret = AddPrimShape(primName, pbs, position, size, rotation, isPhysical); + PhysicsActor ret = AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid); if (ret != null) ret.LocalID = localID; @@ -284,13 +285,7 @@ namespace OpenSim.Region.Physics.Manager */ public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation) //To be removed - { - return AddPrimShape(primName, pbs, position, size, rotation, false); - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical) + Vector3 size, Quaternion rotation, bool isPhysical, uint localid) { m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size); return PhysicsActor.Null; diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index ba8cba4..6fda32d 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -1708,13 +1708,7 @@ namespace OpenSim.Region.Physics.OdePlugin } public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation) //To be removed - { - return AddPrimShape(primName, pbs, position, size, rotation, false); - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical) + Vector3 size, Quaternion rotation, bool isPhysical, uint localid) { #if SPAM m_log.DebugFormat("[PHYSICS]: Adding physics actor to {0}", primName); diff --git a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs index fbd1574..2ea810f 100644 --- a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs +++ b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs @@ -84,7 +84,7 @@ namespace OpenSim.Region.Physics.OdePlugin.Tests Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f); Vector3 size = new Vector3(0.5f, 0.5f, 0.5f); Quaternion rot = Quaternion.Identity; - PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true); + PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true, 0); OdePrim oprim = (OdePrim)prim; OdeScene pscene = (OdeScene) ps; diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/Physics/POSPlugin/POSScene.cs index c3f5040..2f24a50 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSScene.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSScene.cs @@ -91,13 +91,7 @@ namespace OpenSim.Region.Physics.POSPlugin */ public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation) - { - return AddPrimShape(primName, pbs, position, size, rotation, false); - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical) + Vector3 size, Quaternion rotation, bool isPhysical, uint localid) { POSPrim prim = new POSPrim(); prim.Position = position; diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs index 4de4b01..beb3404 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs @@ -108,13 +108,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin } public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation) //To be removed - { - return AddPrimShape(primName, pbs, position, size, rotation, false); - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical) + Vector3 size, Quaternion rotation, bool isPhysical, uint localid) { return AddPrim(position, size, rotation); } -- cgit v1.1 From 18652eb87ef0613b66664059581f991448d76af4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 01:36:27 +0100 Subject: Fix physics proxy regeneration when a mesh with more than one submesh is resized Addresses http://opensimulator.org/mantis/view.php?id=5584 --- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 5 ++++- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 5ca5f20..5413aa8 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -303,6 +303,10 @@ namespace OpenSim.Region.Physics.Meshing private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, Vector3 size, float lod) { +// m_log.DebugFormat( +// "[MESH]: Creating physics proxy for {0}, shape {1}", +// primName, (OpenMetaverse.SculptType)primShape.SculptType); + PrimMesh primMesh; PrimMesher.SculptMesh sculptMesh; @@ -668,7 +672,6 @@ namespace OpenSim.Region.Physics.Meshing // If this mesh has been created already, return it instead of creating another copy // For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory - key = GetMeshKey(primShape, size, lod); if (m_uniqueMeshes.TryGetValue(key, out mesh)) return mesh; diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 27bf942..b3045bd 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -2284,6 +2284,7 @@ Console.WriteLine("changeshape not need meshing"); if (value.IsFinite()) { _size = value; +// m_log.DebugFormat("[PHYSICS]: Set size on {0} to {1}", Name, value); } else { -- cgit v1.1 From 9fc7d65df7a094649eaa34921827ed1316ab67a5 Mon Sep 17 00:00:00 2001 From: Careminster Team Date: Tue, 19 Jul 2011 10:25:49 -0700 Subject: Apply the localID to the Physics actor to prevent null calls later --- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 6fda32d..a307469 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -1677,7 +1677,7 @@ namespace OpenSim.Region.Physics.OdePlugin } private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, - IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) + IMesh mesh, PrimitiveBaseShape pbs, bool isphysical, uint localID) { Vector3 pos = position; Vector3 siz = size; @@ -1691,7 +1691,7 @@ namespace OpenSim.Region.Physics.OdePlugin lock (_prims) _prims.Add(newPrim); } - + newPrim.LocalID = localID; return newPrim; } @@ -1733,7 +1733,7 @@ namespace OpenSim.Region.Physics.OdePlugin // } // } - result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical); + result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, localid); return result; } -- cgit v1.1 From 3270bd560e29fcc871cab6e99a504903eef7af0e Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Wed, 20 Jul 2011 14:34:02 -0700 Subject: Removed unused AddPrimShape methods in PhysicsScene caused by merge conflicts --- OpenSim/Region/Physics/Manager/PhysicsScene.cs | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 28ace34..3870411 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs @@ -88,23 +88,9 @@ namespace OpenSim.Region.Physics.Manager public abstract void RemovePrim(PhysicsActor prim); - //public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - // Vector3 size, Quaternion rotation); //To be removed - Actually removed! - public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation, bool isPhysical, uint localid); - public virtual PhysicsActor AddPrimShape(uint localID, string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical, uint localid) - { - PhysicsActor ret = AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid); - - if (ret != null) - ret.LocalID = localID; - - return ret; - } - public virtual float TimeDilation { get { return 1.0f; } -- cgit v1.1