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 )

avinationmerge
UbitUmarov 2012-03-21 01:46:41 +00:00
parent 2e41294da9
commit 11ed932263
5 changed files with 57 additions and 5 deletions

View File

@ -1832,6 +1832,7 @@ namespace OpenSim.Region.Framework.Scenes
GetWorldRotation(),
isPhysical,
isPhantom,
PhysicsShapeType,
m_localId);
}
catch
@ -4732,6 +4733,7 @@ namespace OpenSim.Region.Framework.Scenes
GetWorldRotation(), //physics wants world rotation like all other functions send
UsePhysics,
SetPhantom,
PhysicsShapeType,
m_localId);
PhysActor.SetMaterial(Material);

View File

@ -172,6 +172,8 @@ namespace OpenSim.Region.Physics.Manager
public virtual bool Phantom { get; set; }
public virtual byte PhysicsShapeType { get; set; }
public abstract PrimitiveBaseShape Shape { set; }
uint m_baseLocalID;
@ -252,6 +254,11 @@ namespace OpenSim.Region.Physics.Manager
{
}
public virtual float Density { get; set; }
public virtual float GravModifier { get; set; }
public virtual float Friction { get; set; }
public virtual float Bounce { get; set; }
/// <summary>
/// Position of this actor.
/// </summary>

View File

@ -137,6 +137,13 @@ namespace OpenSim.Region.Physics.Manager
return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid);
}
public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapetype, uint localid)
{
return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid);
}
public virtual float TimeDilation
{
get { return 1.0f; }

View File

@ -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);

View File

@ -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; }