Stop OdePrim and OdeCharacter insanely overriding set LocalID to set their own private m_localID property but leaving get to return the then unset PhysicsActor.LocalId!

Instead, just have both subclasses use the PhysicsActor.LocalID property.
This restores collision functionality that fell away in 45c7789 yesterday
iar_mods
Justin Clark-Casey (justincc) 2011-11-16 23:01:59 +00:00
parent bd01c4a5cb
commit b6d83e9c0f
9 changed files with 40 additions and 44 deletions

View File

@ -103,7 +103,11 @@ namespace OpenSim.Region.Framework.Scenes
public virtual uint LocalId public virtual uint LocalId
{ {
get { return m_localId; } get { return m_localId; }
set { m_localId = value; } set
{
m_localId = value;
// m_log.DebugFormat("[ENTITY BASE]: Set part {0} to local id {1}", Name, m_localId);
}
} }
/// <summary> /// <summary>

View File

@ -517,7 +517,11 @@ namespace OpenSim.Region.Framework.Scenes
public uint LocalId public uint LocalId
{ {
get { return m_localId; } get { return m_localId; }
set { m_localId = value; } set
{
m_localId = value;
// m_log.DebugFormat("[SCENE OBJECT PART]: Set part {0} to local id {1}", Name, m_localId);
}
} }
public virtual string Name public virtual string Name

View File

@ -756,7 +756,7 @@ namespace OpenSim.Region.Framework.Scenes
m_name = String.Format("{0} {1}", Firstname, Lastname); m_name = String.Format("{0} {1}", Firstname, Lastname);
m_scene = world; m_scene = world;
m_uuid = client.AgentId; m_uuid = client.AgentId;
m_localId = m_scene.AllocateLocalId(); LocalId = m_scene.AllocateLocalId();
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);
if (account != null) if (account != null)

View File

@ -25,8 +25,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using log4net;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection;
using OpenSim.Framework; using OpenSim.Framework;
using OpenMetaverse; using OpenMetaverse;
@ -46,10 +48,10 @@ namespace OpenSim.Region.Physics.Manager
public enum PIDHoverType public enum PIDHoverType
{ {
Ground Ground,
, GroundAndWater GroundAndWater,
, Water Water,
, Absolute Absolute
} }
public struct ContactPoint public struct ContactPoint
@ -114,6 +116,8 @@ namespace OpenSim.Region.Physics.Manager
public abstract class PhysicsActor public abstract class PhysicsActor
{ {
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public delegate void RequestTerseUpdate(); public delegate void RequestTerseUpdate();
public delegate void CollisionUpdate(EventArgs e); public delegate void CollisionUpdate(EventArgs e);
public delegate void OutOfBounds(Vector3 pos); public delegate void OutOfBounds(Vector3 pos);
@ -197,11 +201,11 @@ namespace OpenSim.Region.Physics.Manager
{ {
CollisionUpdate handler = OnCollisionUpdate; CollisionUpdate handler = OnCollisionUpdate;
// m_log.DebugFormat("[PHYSICS ACTOR]: Sending collision for {0}", LocalID);
if (handler != null) if (handler != null)
{
handler(e); handler(e);
} }
}
public virtual void SetMaterial (int material) public virtual void SetMaterial (int material)
{ {

View File

@ -108,7 +108,6 @@ namespace OpenSim.Region.Physics.OdePlugin
/// </summary> /// </summary>
private Vector3 m_taintForce; private Vector3 m_taintForce;
internal uint m_localID = 0;
// taints and their non-tainted counterparts // taints and their non-tainted counterparts
private bool m_isPhysical = false; // the current physical status private bool m_isPhysical = false; // the current physical status
private bool m_tainted_isPhysical = false; // set when the physical status is tainted (false=not existing in physics engine, true=existing) private bool m_tainted_isPhysical = false; // set when the physical status is tainted (false=not existing in physics engine, true=existing)
@ -231,11 +230,6 @@ namespace OpenSim.Region.Physics.OdePlugin
set { m_alwaysRun = value; } set { m_alwaysRun = value; }
} }
public override uint LocalID
{
set { m_localID = value; }
}
public override bool Grabbed public override bool Grabbed
{ {
set { return; } set { return; }

View File

@ -142,8 +142,6 @@ namespace OpenSim.Region.Physics.OdePlugin
public bool m_taintselected { get; private set; } public bool m_taintselected { get; private set; }
public bool m_taintCollidesWater { get; private set; } public bool m_taintCollidesWater { get; private set; }
public uint m_localID { get; private set; }
private bool m_taintforce = false; private bool m_taintforce = false;
private bool m_taintaddangularforce = false; private bool m_taintaddangularforce = false;
private Vector3 m_force; private Vector3 m_force;
@ -290,13 +288,6 @@ namespace OpenSim.Region.Physics.OdePlugin
set { return; } set { return; }
} }
public override uint LocalID
{
set {
//m_log.Info("[PHYSICS]: Setting TrackerID: " + value);
m_localID = value; }
}
public override bool Grabbed public override bool Grabbed
{ {
set { return; } set { return; }
@ -1058,7 +1049,7 @@ Console.WriteLine("ZProcessTaints for " + Name);
private void AddChildPrim(OdePrim prim) private void AddChildPrim(OdePrim prim)
{ {
//Console.WriteLine("AddChildPrim " + Name); //Console.WriteLine("AddChildPrim " + Name);
if (this.m_localID != prim.m_localID) if (LocalID != prim.LocalID)
{ {
if (Body == IntPtr.Zero) if (Body == IntPtr.Zero)
{ {

View File

@ -371,12 +371,13 @@ namespace OpenSim.Region.Physics.OdePlugin
// Loop over contacts, build results. // Loop over contacts, build results.
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
if (p1 != null) { if (p1 != null)
{
if (p1 is OdePrim) if (p1 is OdePrim)
{ {
ContactResult collisionresult = new ContactResult(); ContactResult collisionresult = new ContactResult();
collisionresult.ConsumerID = ((OdePrim)p1).m_localID; collisionresult.ConsumerID = p1.LocalID;
collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z); collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z);
collisionresult.Depth = contacts[i].depth; collisionresult.Depth = contacts[i].depth;
collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y, collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y,
@ -392,7 +393,7 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
ContactResult collisionresult = new ContactResult(); ContactResult collisionresult = new ContactResult();
collisionresult.ConsumerID = ((OdePrim)p2).m_localID; collisionresult.ConsumerID = p2.LocalID;
collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z); collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z);
collisionresult.Depth = contacts[i].depth; collisionresult.Depth = contacts[i].depth;
collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y, collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y,

View File

@ -1306,8 +1306,8 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
case ActorTypes.Agent: case ActorTypes.Agent:
cc1 = (OdeCharacter)p1; cc1 = (OdeCharacter)p1;
obj2LocalID = cc1.m_localID; obj2LocalID = cc1.LocalID;
cc1.AddCollisionEvent(cc2.m_localID, contact); cc1.AddCollisionEvent(cc2.LocalID, contact);
//ctype = (int)CollisionCategories.Character; //ctype = (int)CollisionCategories.Character;
//if (cc1.CollidingObj) //if (cc1.CollidingObj)
@ -1322,8 +1322,8 @@ namespace OpenSim.Region.Physics.OdePlugin
if (p1 is OdePrim) if (p1 is OdePrim)
{ {
cp1 = (OdePrim) p1; cp1 = (OdePrim) p1;
obj2LocalID = cp1.m_localID; obj2LocalID = cp1.LocalID;
cp1.AddCollisionEvent(cc2.m_localID, contact); cp1.AddCollisionEvent(cc2.LocalID, contact);
} }
//ctype = (int)CollisionCategories.Geom; //ctype = (int)CollisionCategories.Geom;
@ -1359,8 +1359,8 @@ namespace OpenSim.Region.Physics.OdePlugin
if (p1 is OdeCharacter) if (p1 is OdeCharacter)
{ {
cc1 = (OdeCharacter) p1; cc1 = (OdeCharacter) p1;
obj2LocalID = cc1.m_localID; obj2LocalID = cc1.LocalID;
cc1.AddCollisionEvent(cp2.m_localID, contact); cc1.AddCollisionEvent(cp2.LocalID, contact);
//ctype = (int)CollisionCategories.Character; //ctype = (int)CollisionCategories.Character;
//if (cc1.CollidingObj) //if (cc1.CollidingObj)
@ -1375,8 +1375,8 @@ namespace OpenSim.Region.Physics.OdePlugin
if (p1 is OdePrim) if (p1 is OdePrim)
{ {
cp1 = (OdePrim) p1; cp1 = (OdePrim) p1;
obj2LocalID = cp1.m_localID; obj2LocalID = cp1.LocalID;
cp1.AddCollisionEvent(cp2.m_localID, contact); cp1.AddCollisionEvent(cp2.LocalID, contact);
//ctype = (int)CollisionCategories.Geom; //ctype = (int)CollisionCategories.Geom;
//if (cp1.CollidingObj) //if (cp1.CollidingObj)
@ -1638,7 +1638,7 @@ namespace OpenSim.Region.Physics.OdePlugin
/// <param name="obj"></param> /// <param name="obj"></param>
internal void AddCollisionEventReporting(PhysicsActor obj) internal void AddCollisionEventReporting(PhysicsActor obj)
{ {
// m_log.DebugFormat("[PHYSICS]: Adding {0} to collision event reporting", obj.SOPName); // m_log.DebugFormat("[PHYSICS]: Adding {0} {1} to collision event reporting", obj.SOPName, obj.LocalID);
lock (_collisionEventPrimChanges) lock (_collisionEventPrimChanges)
_collisionEventPrimChanges[obj.LocalID] = obj; _collisionEventPrimChanges[obj.LocalID] = obj;
@ -1650,7 +1650,7 @@ namespace OpenSim.Region.Physics.OdePlugin
/// <param name="obj"></param> /// <param name="obj"></param>
internal void RemoveCollisionEventReporting(PhysicsActor obj) internal void RemoveCollisionEventReporting(PhysicsActor obj)
{ {
// m_log.DebugFormat("[PHYSICS]: Removing {0} from collision event reporting", obj.SOPName); // m_log.DebugFormat("[PHYSICS]: Removing {0} {1} from collision event reporting", obj.SOPName, obj.LocalID);
lock (_collisionEventPrimChanges) lock (_collisionEventPrimChanges)
_collisionEventPrimChanges[obj.LocalID] = null; _collisionEventPrimChanges[obj.LocalID] = null;
@ -1754,9 +1754,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, bool isPhysical, uint localid) Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
{ {
#if SPAM // m_log.DebugFormat("[ODE SCENE]: Adding physics actor to {0} {1}", primName, localid);
m_log.DebugFormat("[PHYSICS]: Adding physics actor to {0}", primName);
#endif
return AddPrim(primName, position, size, rotation, pbs, isPhysical, localid); return AddPrim(primName, position, size, rotation, pbs, isPhysical, localid);
} }
@ -2810,7 +2808,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
foreach (PhysicsActor obj in _collisionEventPrim.Values) foreach (PhysicsActor obj in _collisionEventPrim.Values)
{ {
// m_log.DebugFormat("[PHYSICS]: Assessing {0} for collision events", obj.SOPName); // m_log.DebugFormat("[PHYSICS]: Assessing {0} {1} for collision events", obj.SOPName, obj.LocalID);
switch ((ActorTypes)obj.PhysicsActorType) switch ((ActorTypes)obj.PhysicsActorType)
{ {
@ -3746,7 +3744,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
{ {
if (prm.CollisionScore > 0) if (prm.CollisionScore > 0)
{ {
returncolliders.Add(prm.m_localID, prm.CollisionScore); returncolliders.Add(prm.LocalID, prm.CollisionScore);
cnt++; cnt++;
prm.CollisionScore = 0f; prm.CollisionScore = 0f;
if (cnt > 25) if (cnt > 25)

View File

@ -104,7 +104,7 @@ namespace OpenSim.Region.Physics.OdePlugin.Tests
m_log.Info("TargetSpace: " + oprim.m_targetSpace + " - SceneMainSpace: " + pscene.space); m_log.Info("TargetSpace: " + oprim.m_targetSpace + " - SceneMainSpace: " + pscene.space);
Assert.That(!oprim.m_taintadd); Assert.That(!oprim.m_taintadd);
m_log.Info("Prim Position (" + oprim.m_localID + "): " + prim.Position.ToString()); m_log.Info("Prim Position (" + oprim.LocalID + "): " + prim.Position);
// Make sure we're above the ground // Make sure we're above the ground
//Assert.That(prim.Position.Z > 20f); //Assert.That(prim.Position.Z > 20f);