From 21a76a619f62e76f366d8bfa1f37f776cfb92fa3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 11 Mar 2012 06:32:06 +0000 Subject: initial steps to support physical phantoms --- OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs | 8 +++++- OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs | 33 ++++++++++++++++++++----- 2 files changed, 34 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Physics/ChOdePlugin') diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs index 3ed3b5a..42a408e 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs @@ -131,6 +131,7 @@ namespace OpenSim.Region.Physics.OdePlugin public bool m_disabled; public bool m_taintadd; public bool m_taintselected; + public bool m_taintphantom; public bool m_taintCollidesWater; public uint m_localID; @@ -161,6 +162,7 @@ namespace OpenSim.Region.Physics.OdePlugin private bool iscolliding; private bool m_isphysical; + private bool m_isphantom; private bool m_isSelected; private bool m_NoColide; // for now only for internal use for bad meshs @@ -311,8 +313,9 @@ namespace OpenSim.Region.Physics.OdePlugin m_taintvehicledata = vdata; _parent_scene.AddPhysicsActorTaint(this); } + public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, - Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode, uint localid) + Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom, CollisionLocker dode, uint localid) { m_localID = localid; ode = dode; @@ -373,6 +376,9 @@ namespace OpenSim.Region.Physics.OdePlugin m_targetSpace = _parent_scene.space; } + m_isphantom = pisPhantom; + m_taintphantom = pisPhantom; + _triMeshData = IntPtr.Zero; m_NoColide = false; diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs index 05f6fae..ea89d87 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs @@ -1730,7 +1730,7 @@ namespace OpenSim.Region.Physics.OdePlugin OdePrim newPrim; lock (OdeLock) { - newPrim = new OdePrim(name, this, pos, siz, rot, mesh, pbs, isphysical, ode, localid); + newPrim = new OdePrim(name, this, pos, siz, rot, mesh, pbs, isphysical,false, ode, localid); lock (_prims) _prims.Add(newPrim); @@ -1738,23 +1738,27 @@ namespace OpenSim.Region.Physics.OdePlugin return newPrim; } -/* - private PhysicsActor AddPrim(String name, Vector3 position, PhysicsActor parent, - PrimitiveBaseShape pbs, uint localid, byte[] sdata) + + private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, + IMesh mesh, PrimitiveBaseShape pbs, bool isphysical, bool isphantom, uint localid) { + Vector3 pos = position; + Vector3 siz = size; + Quaternion rot = rotation; OdePrim newPrim; lock (OdeLock) { - newPrim = new OdePrim(name, this, pos, parent, pbs, ode, localid, sdata); + newPrim = new OdePrim(name, this, pos, siz, rot, mesh, pbs, isphysical, isphantom, ode, localid); + lock (_prims) _prims.Add(newPrim); } return newPrim; } -*/ + public void addActivePrim(OdePrim activatePrim) { @@ -1781,6 +1785,23 @@ namespace OpenSim.Region.Physics.OdePlugin return result; } + + public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, + Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, uint localid) + { + PhysicsActor result; + IMesh mesh = null; + + if (needsMeshing(pbs)) + mesh = mesher.CreateMesh(primName, pbs, size, (int)LevelOfDetail.High, true); + + result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, isPhantom, localid); + + return result; + } + + + /* public override PhysicsActor AddPrimShape(string primName, PhysicsActor parent, PrimitiveBaseShape pbs, Vector3 position, uint localid, byte[] sdata) -- cgit v1.1