* 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 Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
rootPart.doPhysicsPropertyUpdate(UsePhysics);
}
MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
}

View File

@ -130,8 +130,8 @@ namespace OpenSim.Region.Environment.Scenes
public uint ObjectFlags
{
get { return (uint) m_flags; }
set { m_flags = (LLObject.ObjectFlags) value; }
get { return (uint) m_flags;}
set {m_flags = (LLObject.ObjectFlags) value;}
}
protected LLObject.MaterialType m_material = 0;
@ -416,7 +416,7 @@ namespace OpenSim.Region.Environment.Scenes
m_name = "Primitive";
m_regionHandle = regionHandle;
m_parentGroup = parent;
CreationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
OwnerID = ownerID;
CreatorID = OwnerID;
@ -472,7 +472,7 @@ namespace OpenSim.Region.Environment.Scenes
{
m_regionHandle = regionHandle;
m_parentGroup = parent;
TimeStampTerse = (uint)Util.UnixTimeSinceEpoch();
CreationDate = creationDate;
OwnerID = ownerID;
CreatorID = creatorID;
@ -490,6 +490,9 @@ namespace OpenSim.Region.Environment.Scenes
OffsetPosition = position;
RotationOffset = rotation;
ObjectFlags = flags;
bool UsePhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0);
doPhysicsPropertyUpdate(UsePhysics);
ScheduleFullUpdate();
}
#endregion
@ -502,7 +505,11 @@ namespace OpenSim.Region.Environment.Scenes
public static SceneObjectPart FromXml(XmlReader xmlReader)
{
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>
@ -567,6 +574,8 @@ namespace OpenSim.Region.Environment.Scenes
byte[] extraP = new byte[Shape.ExtraParams.Length];
Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
dupe.Shape.ExtraParams = extraP;
bool UsePhysics = ((dupe.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0);
dupe.doPhysicsPropertyUpdate(UsePhysics);
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());
ScheduleFullUpdate();
}
private void doPhysicsPropertyUpdate(bool UsePhysics)
public void doPhysicsPropertyUpdate(bool UsePhysics)
{
if (PhysActor != null)
{
if (PhysActor.IsPhysical)
@ -903,21 +913,31 @@ namespace OpenSim.Region.Environment.Scenes
/// that's not wholesome. Had to make m_scene public
PhysActor = null;
PhysActor = m_parentGroup.m_scene.PhysScene.AddPrimShape(
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)
if (!((ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) != 0))
{
PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
PhysActor.OnOutOfBounds += PhysicsOutOfBounds;
PhysActor = m_parentGroup.m_scene.PhysScene.AddPrimShape(
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)
@ -1162,6 +1182,7 @@ namespace OpenSim.Region.Environment.Scenes
public void PhysicsRequestingTerseUpdate()
{
ScheduleTerseUpdate();
//SendTerseUpdateToAllClients();
}
#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
// 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
part.SendFullUpdate(ControllingClient);
@ -357,7 +354,10 @@ namespace OpenSim.Region.Environment.Scenes
}
else if (update.LastTerseUpdateTime <= part.TimeStampTerse)
{
part.SendTerseUpdate(ControllingClient);
update.LastTerseUpdateTime = part.TimeStampTerse;
updateCount++;
}

View File

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