shapetype support on chOde so it can also request a simple convex hull 'mesh'
parent
312f0c6970
commit
316f272b62
|
@ -179,6 +179,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
public bool m_outofBounds;
|
public bool m_outofBounds;
|
||||||
private float m_density = 10.000006836f; // Aluminum g/cm3;
|
private float m_density = 10.000006836f; // Aluminum g/cm3;
|
||||||
|
|
||||||
|
private byte m_shapetype;
|
||||||
|
private byte m_taintshapetype;
|
||||||
|
|
||||||
public bool _zeroFlag; // if body has been stopped
|
public bool _zeroFlag; // if body has been stopped
|
||||||
private bool m_lastUpdateSent;
|
private bool m_lastUpdateSent;
|
||||||
|
|
||||||
|
@ -315,7 +318,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size,
|
public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size,
|
||||||
Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom, CollisionLocker dode, uint localid)
|
Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical,
|
||||||
|
bool pisPhantom,byte shapetype, CollisionLocker dode, uint localid)
|
||||||
{
|
{
|
||||||
m_localID = localid;
|
m_localID = localid;
|
||||||
ode = dode;
|
ode = dode;
|
||||||
|
@ -360,6 +364,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
m_taintrot = _orientation;
|
m_taintrot = _orientation;
|
||||||
_mesh = mesh;
|
_mesh = mesh;
|
||||||
_pbs = pbs;
|
_pbs = pbs;
|
||||||
|
m_shapetype = shapetype;
|
||||||
|
m_taintshapetype = shapetype;
|
||||||
|
|
||||||
_parent_scene = parent_scene;
|
_parent_scene = parent_scene;
|
||||||
m_targetSpace = (IntPtr)0;
|
m_targetSpace = (IntPtr)0;
|
||||||
|
@ -605,6 +611,19 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override byte PhysicsShapeType
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return m_shapetype;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
m_taintshapetype = value;
|
||||||
|
_parent_scene.AddPhysicsActorTaint(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override Vector3 Velocity
|
public override Vector3 Velocity
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -1535,6 +1554,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
changesize(timestep);
|
changesize(timestep);
|
||||||
//
|
//
|
||||||
|
|
||||||
|
if(m_taintshapetype != m_shapetype)
|
||||||
|
{
|
||||||
|
m_shapetype = m_taintshapetype;
|
||||||
|
changeshape(timestep);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_taintshape)
|
if (m_taintshape)
|
||||||
changeshape(timestep);
|
changeshape(timestep);
|
||||||
//
|
//
|
||||||
|
@ -2476,9 +2501,16 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
if (IsPhysical)
|
if (IsPhysical)
|
||||||
meshlod = _parent_scene.MeshSculptphysicalLOD;
|
meshlod = _parent_scene.MeshSculptphysicalLOD;
|
||||||
|
|
||||||
|
bool convex;
|
||||||
|
if (m_shapetype == 2)
|
||||||
|
convex = true;
|
||||||
|
else
|
||||||
|
convex = false;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, (int)LevelOfDetail.High, true);
|
mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, (int)LevelOfDetail.High, true, convex);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
|
@ -1720,7 +1720,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
|
private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
|
||||||
IMesh mesh, PrimitiveBaseShape pbs, bool isphysical, uint localid)
|
IMesh mesh, PrimitiveBaseShape pbs, bool isphysical, bool isphantom, byte shapetype, uint localid)
|
||||||
{
|
{
|
||||||
|
|
||||||
Vector3 pos = position;
|
Vector3 pos = position;
|
||||||
|
@ -1730,27 +1730,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
OdePrim newPrim;
|
OdePrim newPrim;
|
||||||
lock (OdeLock)
|
lock (OdeLock)
|
||||||
{
|
{
|
||||||
newPrim = new OdePrim(name, this, pos, siz, rot, mesh, pbs, isphysical,false, ode, localid);
|
newPrim = new OdePrim(name, this, pos, siz, rot, mesh, pbs, isphysical, isphantom, shapetype, ode, localid);
|
||||||
|
|
||||||
lock (_prims)
|
|
||||||
_prims.Add(newPrim);
|
|
||||||
}
|
|
||||||
|
|
||||||
return newPrim;
|
|
||||||
}
|
|
||||||
|
|
||||||
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, siz, rot, mesh, pbs, isphysical, isphantom, ode, localid);
|
|
||||||
|
|
||||||
lock (_prims)
|
lock (_prims)
|
||||||
_prims.Add(newPrim);
|
_prims.Add(newPrim);
|
||||||
|
@ -1781,7 +1761,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
if (needsMeshing(pbs))
|
if (needsMeshing(pbs))
|
||||||
mesh = mesher.CreateMesh(primName, pbs, size, (int)LevelOfDetail.High, true);
|
mesh = mesher.CreateMesh(primName, pbs, size, (int)LevelOfDetail.High, true);
|
||||||
|
|
||||||
result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, localid);
|
result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical,false,0, localid);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1795,25 +1775,25 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
if (needsMeshing(pbs))
|
if (needsMeshing(pbs))
|
||||||
mesh = mesher.CreateMesh(primName, pbs, size, (int)LevelOfDetail.High, true);
|
mesh = mesher.CreateMesh(primName, pbs, size, (int)LevelOfDetail.High, true);
|
||||||
|
|
||||||
result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, isPhantom, localid);
|
result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, isPhantom,0, localid);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||||
|
Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapetype, uint localid)
|
||||||
/*
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PhysicsActor parent, PrimitiveBaseShape pbs, Vector3 position,
|
|
||||||
uint localid, byte[] sdata)
|
|
||||||
{
|
{
|
||||||
PhysicsActor result;
|
PhysicsActor result;
|
||||||
|
IMesh mesh = null;
|
||||||
|
|
||||||
result = AddPrim(primName, position, parent,
|
if (needsMeshing(pbs))
|
||||||
pbs, localid, sdata);
|
mesh = mesher.CreateMesh(primName, pbs, size, (int)LevelOfDetail.High, true);
|
||||||
|
|
||||||
|
result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, isPhantom, shapetype, localid);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
public override float TimeDilation
|
public override float TimeDilation
|
||||||
{
|
{
|
||||||
get { return m_timeDilation; }
|
get { return m_timeDilation; }
|
||||||
|
|
Loading…
Reference in New Issue