* Resolved the situation where prim is loaded from storage and when pushed never stops.

afrisby
Teravus Ovares 2007-11-16 22:13:13 +00:00
parent eb2f626561
commit 5fd2fa687e
4 changed files with 45 additions and 23 deletions

View File

@ -553,6 +553,7 @@ namespace OpenSim.Region.Environment.Scenes
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
rootPart.doPhysicsPropertyUpdate(UsePhysics);
} }
MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
} }

View File

@ -130,8 +130,8 @@ namespace OpenSim.Region.Environment.Scenes
public uint ObjectFlags public uint ObjectFlags
{ {
get { return (uint) m_flags; } get { return (uint) m_flags;}
set { m_flags = (LLObject.ObjectFlags) value; } set {m_flags = (LLObject.ObjectFlags) value;}
} }
protected LLObject.MaterialType m_material = 0; protected LLObject.MaterialType m_material = 0;
@ -416,7 +416,7 @@ namespace OpenSim.Region.Environment.Scenes
m_name = "Primitive"; m_name = "Primitive";
m_regionHandle = regionHandle; m_regionHandle = regionHandle;
m_parentGroup = parent; m_parentGroup = parent;
CreationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; CreationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
OwnerID = ownerID; OwnerID = ownerID;
CreatorID = OwnerID; CreatorID = OwnerID;
@ -472,7 +472,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
m_regionHandle = regionHandle; m_regionHandle = regionHandle;
m_parentGroup = parent; m_parentGroup = parent;
TimeStampTerse = (uint)Util.UnixTimeSinceEpoch();
CreationDate = creationDate; CreationDate = creationDate;
OwnerID = ownerID; OwnerID = ownerID;
CreatorID = creatorID; CreatorID = creatorID;
@ -490,6 +490,9 @@ namespace OpenSim.Region.Environment.Scenes
OffsetPosition = position; OffsetPosition = position;
RotationOffset = rotation; RotationOffset = rotation;
ObjectFlags = flags; ObjectFlags = flags;
bool UsePhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0);
doPhysicsPropertyUpdate(UsePhysics);
ScheduleFullUpdate();
} }
#endregion #endregion
@ -502,7 +505,11 @@ namespace OpenSim.Region.Environment.Scenes
public static SceneObjectPart FromXml(XmlReader xmlReader) public static SceneObjectPart FromXml(XmlReader xmlReader)
{ {
XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
return (SceneObjectPart) serializer.Deserialize(xmlReader); SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader);
bool UsePhysics = ((newobject.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0);
newobject.doPhysicsPropertyUpdate(UsePhysics);
return newobject;
} }
/// <summary> /// <summary>
@ -567,6 +574,8 @@ namespace OpenSim.Region.Environment.Scenes
byte[] extraP = new byte[Shape.ExtraParams.Length]; byte[] extraP = new byte[Shape.ExtraParams.Length];
Array.Copy(Shape.ExtraParams, extraP, extraP.Length); Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
dupe.Shape.ExtraParams = extraP; dupe.Shape.ExtraParams = extraP;
bool UsePhysics = ((dupe.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0);
dupe.doPhysicsPropertyUpdate(UsePhysics);
return dupe; return dupe;
} }
@ -890,8 +899,9 @@ namespace OpenSim.Region.Environment.Scenes
// System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
ScheduleFullUpdate(); ScheduleFullUpdate();
} }
private void doPhysicsPropertyUpdate(bool UsePhysics) public void doPhysicsPropertyUpdate(bool UsePhysics)
{ {
if (PhysActor != null) if (PhysActor != null)
{ {
if (PhysActor.IsPhysical) if (PhysActor.IsPhysical)
@ -903,21 +913,31 @@ namespace OpenSim.Region.Environment.Scenes
/// that's not wholesome. Had to make m_scene public /// that's not wholesome. Had to make m_scene public
PhysActor = null; PhysActor = null;
PhysActor = m_parentGroup.m_scene.PhysScene.AddPrimShape( if (!((ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) != 0))
Name,
Shape,
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
AbsolutePosition.Z),
new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
new Quaternion(RotationOffset.W, RotationOffset.X,
RotationOffset.Y, RotationOffset.Z), UsePhysics);
if (UsePhysics)
{ {
PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; PhysActor = m_parentGroup.m_scene.PhysScene.AddPrimShape(
PhysActor.OnOutOfBounds += PhysicsOutOfBounds; Name,
Shape,
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
AbsolutePosition.Z),
new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
new Quaternion(RotationOffset.W, RotationOffset.X,
RotationOffset.Y, RotationOffset.Z), UsePhysics);
if (UsePhysics)
{
PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
PhysActor.OnOutOfBounds += PhysicsOutOfBounds;
}
} }
} }
} }
public void UpdateExtraParam(ushort type, bool inUse, byte[] data) public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
@ -1162,6 +1182,7 @@ namespace OpenSim.Region.Environment.Scenes
public void PhysicsRequestingTerseUpdate() public void PhysicsRequestingTerseUpdate()
{ {
ScheduleTerseUpdate(); ScheduleTerseUpdate();
//SendTerseUpdateToAllClients(); //SendTerseUpdateToAllClients();
} }
#endregion #endregion

View File

@ -337,12 +337,9 @@ namespace OpenSim.Region.Environment.Scenes
// could have been sent in the last update - we still need to send the // could have been sent in the last update - we still need to send the
// second here. // second here.
// after object un-linking was introduced, this broke and needs fixing
// *all* object movements create a fullobjectupdate (which is bad)
// Physical objects do not need this bit of code, so lets make sure that they don't
// get updated and make matters worse until this gets fixed.
if (update.LastFullUpdateTime < part.TimeStampFull && !((part.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) !=0 )) if (update.LastFullUpdateTime < part.TimeStampFull)
{ {
//need to do a full update //need to do a full update
part.SendFullUpdate(ControllingClient); part.SendFullUpdate(ControllingClient);
@ -357,7 +354,10 @@ namespace OpenSim.Region.Environment.Scenes
} }
else if (update.LastTerseUpdateTime <= part.TimeStampTerse) else if (update.LastTerseUpdateTime <= part.TimeStampTerse)
{ {
part.SendTerseUpdate(ControllingClient); part.SendTerseUpdate(ControllingClient);
update.LastTerseUpdateTime = part.TimeStampTerse; update.LastTerseUpdateTime = part.TimeStampTerse;
updateCount++; updateCount++;
} }

View File

@ -524,7 +524,7 @@ namespace OpenSim.Region.Physics.OdePlugin
newPrim = new OdePrim(name, this, targetspace, pos, siz, rot, mesh, pbs, isphysical); newPrim = new OdePrim(name, this, targetspace, pos, siz, rot, mesh, pbs, isphysical);
} }
_prims.Add(newPrim); _prims.Add(newPrim);
OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Added Object");
return newPrim; return newPrim;
} }