Fix some local id issues in physics glue

bulletsim
root 2011-07-15 20:07:59 +01:00
parent b55076990c
commit e9dbe54ab1
10 changed files with 36 additions and 68 deletions

View File

@ -1467,13 +1467,13 @@ namespace OpenSim.Region.Framework.Scenes
newPart.PhysActor newPart.PhysActor
= m_scene.PhysicsScene.AddPrimShape( = m_scene.PhysicsScene.AddPrimShape(
newPart.LocalId,
string.Format("{0}/{1}", newPart.Name, newPart.UUID), string.Format("{0}/{1}", newPart.Name, newPart.UUID),
pbs, pbs,
newPart.AbsolutePosition, newPart.AbsolutePosition,
newPart.Scale, newPart.Scale,
newPart.RotationOffset, newPart.RotationOffset,
part.PhysActor.IsPhysical); part.PhysActor.IsPhysical,
newPart.LocalId);
newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
} }

View File

@ -1588,17 +1588,23 @@ namespace OpenSim.Region.Framework.Scenes
// or flexible // or flexible
if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible))
{ {
// m_log.DebugFormat("[SCENE OBJECT PART]: Creating PhysActor for {0} {1} {2}", Name, LocalId, UUID); try
{
PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
LocalId, string.Format("{0}/{1}", Name, UUID),
string.Format("{0}/{1}", Name, UUID), Shape,
Shape, AbsolutePosition,
AbsolutePosition, Scale,
Scale, RotationOffset,
RotationOffset, RigidBody,
RigidBody); m_localId);
PhysActor.SetMaterial(Material);
}
catch
{
m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
PhysActor = null;
}
// Basic Physics returns null.. joy joy joy. // Basic Physics returns null.. joy joy joy.
if (PhysActor != null) if (PhysActor != null)
{ {
@ -4446,7 +4452,9 @@ namespace OpenSim.Region.Framework.Scenes
AbsolutePosition, AbsolutePosition,
Scale, Scale,
RotationOffset, RotationOffset,
UsePhysics); UsePhysics,
m_localId);
PhysActor.SetMaterial(Material);
pa = PhysActor; pa = PhysActor;
if (pa != null) if (pa != null)

View File

@ -84,13 +84,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
*/ */
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation) Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
{
return AddPrimShape(primName, pbs, position, size, rotation, false);
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical)
{ {
return null; return null;
} }

View File

@ -213,12 +213,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
return newPrim; return newPrim;
} }
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation) public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
{
return AddPrimShape(primName, pbs, position, size, rotation, false);
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation, bool isPhysical)
{ {
PhysicsActor result; PhysicsActor result;
IMesh mesh = null; IMesh mesh = null;

View File

@ -626,13 +626,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
} }
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position, public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position,
OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation) OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation, bool isPhysical, uint localid)
{
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)
{ {
PhysicsActor result; PhysicsActor result;

View File

@ -88,15 +88,16 @@ namespace OpenSim.Region.Physics.Manager
public abstract void RemovePrim(PhysicsActor prim); 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, public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation); //To be removed Vector3 size, Quaternion rotation, bool isPhysical, uint localid);
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical);
public virtual PhysicsActor AddPrimShape(uint localID, string primName, PrimitiveBaseShape pbs, Vector3 position, 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) if (ret != null)
ret.LocalID = localID; ret.LocalID = localID;
@ -284,13 +285,7 @@ namespace OpenSim.Region.Physics.Manager
*/ */
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation) //To be removed Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
{
return AddPrimShape(primName, pbs, position, size, rotation, false);
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical)
{ {
m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size); m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size);
return PhysicsActor.Null; return PhysicsActor.Null;

View File

@ -1708,13 +1708,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation) //To be removed Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
{
return AddPrimShape(primName, pbs, position, size, rotation, false);
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical)
{ {
#if SPAM #if SPAM
m_log.DebugFormat("[PHYSICS]: Adding physics actor to {0}", primName); m_log.DebugFormat("[PHYSICS]: Adding physics actor to {0}", primName);

View File

@ -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 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f);
Vector3 size = new Vector3(0.5f, 0.5f, 0.5f); Vector3 size = new Vector3(0.5f, 0.5f, 0.5f);
Quaternion rot = Quaternion.Identity; 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; OdePrim oprim = (OdePrim)prim;
OdeScene pscene = (OdeScene) ps; OdeScene pscene = (OdeScene) ps;

View File

@ -91,13 +91,7 @@ namespace OpenSim.Region.Physics.POSPlugin
*/ */
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation) Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
{
return AddPrimShape(primName, pbs, position, size, rotation, false);
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical)
{ {
POSPrim prim = new POSPrim(); POSPrim prim = new POSPrim();
prim.Position = position; prim.Position = position;

View File

@ -108,13 +108,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
} }
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation) //To be removed Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
{
return AddPrimShape(primName, pbs, position, size, rotation, false);
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical)
{ {
return AddPrim(position, size, rotation); return AddPrim(position, size, rotation);
} }