aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs55
1 files changed, 38 insertions, 17 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 0a81679..61cc973 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -130,8 +130,8 @@ namespace OpenSim.Region.Environment.Scenes
130 130
131 public uint ObjectFlags 131 public uint ObjectFlags
132 { 132 {
133 get { return (uint) m_flags; } 133 get { return (uint) m_flags;}
134 set { m_flags = (LLObject.ObjectFlags) value; } 134 set {m_flags = (LLObject.ObjectFlags) value;}
135 } 135 }
136 136
137 protected LLObject.MaterialType m_material = 0; 137 protected LLObject.MaterialType m_material = 0;
@@ -416,7 +416,7 @@ namespace OpenSim.Region.Environment.Scenes
416 m_name = "Primitive"; 416 m_name = "Primitive";
417 m_regionHandle = regionHandle; 417 m_regionHandle = regionHandle;
418 m_parentGroup = parent; 418 m_parentGroup = parent;
419 419
420 CreationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 420 CreationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
421 OwnerID = ownerID; 421 OwnerID = ownerID;
422 CreatorID = OwnerID; 422 CreatorID = OwnerID;
@@ -472,7 +472,7 @@ namespace OpenSim.Region.Environment.Scenes
472 { 472 {
473 m_regionHandle = regionHandle; 473 m_regionHandle = regionHandle;
474 m_parentGroup = parent; 474 m_parentGroup = parent;
475 475 TimeStampTerse = (uint)Util.UnixTimeSinceEpoch();
476 CreationDate = creationDate; 476 CreationDate = creationDate;
477 OwnerID = ownerID; 477 OwnerID = ownerID;
478 CreatorID = creatorID; 478 CreatorID = creatorID;
@@ -490,6 +490,9 @@ namespace OpenSim.Region.Environment.Scenes
490 OffsetPosition = position; 490 OffsetPosition = position;
491 RotationOffset = rotation; 491 RotationOffset = rotation;
492 ObjectFlags = flags; 492 ObjectFlags = flags;
493 bool UsePhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0);
494 doPhysicsPropertyUpdate(UsePhysics);
495 ScheduleFullUpdate();
493 } 496 }
494 497
495 #endregion 498 #endregion
@@ -502,7 +505,11 @@ namespace OpenSim.Region.Environment.Scenes
502 public static SceneObjectPart FromXml(XmlReader xmlReader) 505 public static SceneObjectPart FromXml(XmlReader xmlReader)
503 { 506 {
504 XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); 507 XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
505 return (SceneObjectPart) serializer.Deserialize(xmlReader); 508 SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader);
509 bool UsePhysics = ((newobject.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0);
510 newobject.doPhysicsPropertyUpdate(UsePhysics);
511
512 return newobject;
506 } 513 }
507 514
508 /// <summary> 515 /// <summary>
@@ -567,6 +574,8 @@ namespace OpenSim.Region.Environment.Scenes
567 byte[] extraP = new byte[Shape.ExtraParams.Length]; 574 byte[] extraP = new byte[Shape.ExtraParams.Length];
568 Array.Copy(Shape.ExtraParams, extraP, extraP.Length); 575 Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
569 dupe.Shape.ExtraParams = extraP; 576 dupe.Shape.ExtraParams = extraP;
577 bool UsePhysics = ((dupe.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0);
578 dupe.doPhysicsPropertyUpdate(UsePhysics);
570 579
571 return dupe; 580 return dupe;
572 } 581 }
@@ -890,8 +899,9 @@ namespace OpenSim.Region.Environment.Scenes
890// System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); 899// System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
891 ScheduleFullUpdate(); 900 ScheduleFullUpdate();
892 } 901 }
893 private void doPhysicsPropertyUpdate(bool UsePhysics) 902 public void doPhysicsPropertyUpdate(bool UsePhysics)
894 { 903 {
904
895 if (PhysActor != null) 905 if (PhysActor != null)
896 { 906 {
897 if (PhysActor.IsPhysical) 907 if (PhysActor.IsPhysical)
@@ -903,21 +913,31 @@ namespace OpenSim.Region.Environment.Scenes
903 /// that's not wholesome. Had to make m_scene public 913 /// that's not wholesome. Had to make m_scene public
904 PhysActor = null; 914 PhysActor = null;
905 915
906 PhysActor = m_parentGroup.m_scene.PhysScene.AddPrimShape( 916 if (!((ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) != 0))
907 Name,
908 Shape,
909 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
910 AbsolutePosition.Z),
911 new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
912 new Quaternion(RotationOffset.W, RotationOffset.X,
913 RotationOffset.Y, RotationOffset.Z), UsePhysics);
914 if (UsePhysics)
915 { 917 {
916 PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; 918 PhysActor = m_parentGroup.m_scene.PhysScene.AddPrimShape(
917 PhysActor.OnOutOfBounds += PhysicsOutOfBounds; 919 Name,
920 Shape,
921 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
922 AbsolutePosition.Z),
923 new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
924 new Quaternion(RotationOffset.W, RotationOffset.X,
925 RotationOffset.Y, RotationOffset.Z), UsePhysics);
926 if (UsePhysics)
927 {
928 PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
929 PhysActor.OnOutOfBounds += PhysicsOutOfBounds;
930 }
918 } 931 }
932
933
934
919 } 935 }
920 936
937
938
939
940
921 } 941 }
922 942
923 public void UpdateExtraParam(ushort type, bool inUse, byte[] data) 943 public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
@@ -1162,6 +1182,7 @@ namespace OpenSim.Region.Environment.Scenes
1162 public void PhysicsRequestingTerseUpdate() 1182 public void PhysicsRequestingTerseUpdate()
1163 { 1183 {
1164 ScheduleTerseUpdate(); 1184 ScheduleTerseUpdate();
1185
1165 //SendTerseUpdateToAllClients(); 1186 //SendTerseUpdateToAllClients();
1166 } 1187 }
1167 #endregion 1188 #endregion