From 11ed932263161d1dbea99d4a5699ba6d00894053 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 21 Mar 2012 01:46:41 +0000 Subject: Tell physics about physics shape when creating. Added some virtual methods to get/set density,gravmod, frition,bounce and shape type ( not in use ). UbitOde now should do convex type on creation or everytime the mesh is changed ( as in change size, shape, etc ) --- OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 14 ++++++++--- OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 32 ++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Physics/UbitOdePlugin') diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 39b89d3..fd2f88f 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs @@ -163,7 +163,7 @@ namespace OpenSim.Region.Physics.OdePlugin public IntPtr collide_geom; // for objects: geom if single prim space it linkset private float m_density = 10.000006836f; // Aluminum g/cm3; - + private byte m_shapetype; public bool _zeroFlag; private bool m_lastUpdateSent; @@ -846,7 +846,7 @@ namespace OpenSim.Region.Physics.OdePlugin public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, - Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom,uint plocalID) + Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom,byte _shapeType,uint plocalID) { Name = primName; LocalID = plocalID; @@ -920,6 +920,8 @@ namespace OpenSim.Region.Physics.OdePlugin hasOOBoffsetFromMesh = false; _triMeshData = IntPtr.Zero; + m_shapetype = _shapeType; + m_lastdoneSelected = false; m_isSelected = false; m_delaySelect = false; @@ -1050,7 +1052,13 @@ namespace OpenSim.Region.Physics.OdePlugin } } - IMesh mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, (int)LevelOfDetail.High, true); + bool convex; + if (m_shapetype == 0) + convex = false; + else + convex = true; + + IMesh mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, (int)LevelOfDetail.High, true,convex); if (mesh == null) { m_log.WarnFormat("[PHYSICS]: CreateMesh Failed on prim {0} at <{1},{2},{3}>.", Name, _position.X, _position.Y, _position.Z); diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index 612eafd..76d7746 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs @@ -1141,7 +1141,7 @@ namespace OpenSim.Region.Physics.OdePlugin OdePrim newPrim; lock (OdeLock) { - newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical,false,localID); + newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical,false,0,localID); lock (_prims) _prims.Add(newPrim); @@ -1159,7 +1159,25 @@ namespace OpenSim.Region.Physics.OdePlugin OdePrim newPrim; lock (OdeLock) { - newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical,isPhantom,localID); + newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical, isPhantom, 0, localID); + + lock (_prims) + _prims.Add(newPrim); + } + return newPrim; + } + + private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, + PrimitiveBaseShape pbs, bool isphysical, bool isPhantom, byte shapeType, uint localID) + { + Vector3 pos = position; + Vector3 siz = size; + Quaternion rot = rotation; + + OdePrim newPrim; + lock (OdeLock) + { + newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical, isPhantom, shapeType, localID); lock (_prims) _prims.Add(newPrim); @@ -1203,6 +1221,16 @@ namespace OpenSim.Region.Physics.OdePlugin return AddPrim(primName, position, size, rotation, pbs, isPhysical, localid); } + public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, + Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapeType, uint localid) + { +#if SPAM + m_log.DebugFormat("[PHYSICS]: Adding physics actor to {0}", primName); +#endif + + return AddPrim(primName, position, size, rotation, pbs, isPhysical,isPhantom, shapeType, localid); + } + public override float TimeDilation { get { return m_timeDilation; } -- cgit v1.1