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.cs698
1 files changed, 311 insertions, 387 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 5861298..ea10fe6 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -33,10 +33,8 @@ using System.Security.Permissions;
33using System.Xml; 33using System.Xml;
34using System.Xml.Serialization; 34using System.Xml.Serialization;
35 35
36using Axiom.Math; 36using OpenMetaverse;
37 37using OpenMetaverse.Packets;
38using libsecondlife;
39using libsecondlife.Packets;
40 38
41using OpenSim.Framework; 39using OpenSim.Framework;
42using OpenSim.Region.Environment.Scenes.Scripting; 40using OpenSim.Region.Environment.Scenes.Scripting;
@@ -114,7 +112,7 @@ namespace OpenSim.Region.Environment.Scenes
114 // Not a big problem as long as the script that sets it remains in the prim on startup. 112 // Not a big problem as long as the script that sets it remains in the prim on startup.
115 // for SL compatibility it should be persisted though (set sound / displaytext / particlesystem, kill script) 113 // for SL compatibility it should be persisted though (set sound / displaytext / particlesystem, kill script)
116 [XmlIgnore] 114 [XmlIgnore]
117 public LLUUID Sound; 115 public UUID Sound;
118 [XmlIgnore] 116 [XmlIgnore]
119 public byte SoundFlags; 117 public byte SoundFlags;
120 [XmlIgnore] 118 [XmlIgnore]
@@ -128,15 +126,15 @@ namespace OpenSim.Region.Environment.Scenes
128 [XmlIgnore] 126 [XmlIgnore]
129 public uint TimeStampTerse = 0; 127 public uint TimeStampTerse = 0;
130 [XmlIgnore] 128 [XmlIgnore]
131 public LLUUID FromAssetID = LLUUID.Zero; 129 public UUID FromAssetID = UUID.Zero;
132 [XmlIgnore] 130 [XmlIgnore]
133 public bool IsAttachment = false; 131 public bool IsAttachment = false;
134 [XmlIgnore] 132 [XmlIgnore]
135 public scriptEvents AggregateScriptEvents = 0; 133 public scriptEvents AggregateScriptEvents = 0;
136 [XmlIgnore] 134 [XmlIgnore]
137 public LLUUID AttachedAvatar = LLUUID.Zero; 135 public UUID AttachedAvatar = UUID.Zero;
138 [XmlIgnore] 136 [XmlIgnore]
139 public LLVector3 AttachedPos = LLVector3.Zero; 137 public Vector3 AttachedPos = Vector3.Zero;
140 [XmlIgnore] 138 [XmlIgnore]
141 public uint AttachmentPoint = (byte)0; 139 public uint AttachmentPoint = (byte)0;
142 [XmlIgnore] 140 [XmlIgnore]
@@ -146,7 +144,7 @@ namespace OpenSim.Region.Environment.Scenes
146 public bool Undoing = false; 144 public bool Undoing = false;
147 145
148 [XmlIgnore] 146 [XmlIgnore]
149 private LLObject.ObjectFlags LocalFlags = LLObject.ObjectFlags.None; 147 private PrimFlags LocalFlags = 0;
150 private byte[] m_TextureAnimation; 148 private byte[] m_TextureAnimation;
151 private byte m_clickAction = 0; 149 private byte m_clickAction = 0;
152 private Color m_color = Color.Black; 150 private Color m_color = Color.Black;
@@ -157,14 +155,14 @@ namespace OpenSim.Region.Environment.Scenes
157 [XmlIgnore] 155 [XmlIgnore]
158 private int m_scriptAccessPin = 0; 156 private int m_scriptAccessPin = 0;
159 [XmlIgnore] 157 [XmlIgnore]
160 private readonly Dictionary<LLUUID, scriptEvents> m_scriptEvents = new Dictionary<LLUUID, scriptEvents>(); 158 private readonly Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>();
161 private string m_sitName = String.Empty; 159 private string m_sitName = String.Empty;
162 private Quaternion m_sitTargetOrientation = new Quaternion(0, 0, 0, 1); 160 private Quaternion m_sitTargetOrientation = Quaternion.Identity;
163 private Vector3 m_sitTargetPosition = new Vector3(0, 0, 0); 161 private Vector3 m_sitTargetPosition = Vector3.Zero;
164 private string m_text = String.Empty; 162 private string m_text = String.Empty;
165 private string m_touchName = String.Empty; 163 private string m_touchName = String.Empty;
166 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); 164 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5);
167 private LLUUID _creatorID; 165 private UUID _creatorID;
168 166
169 /// <summary> 167 /// <summary>
170 /// Only used internally to schedule client updates. 168 /// Only used internally to schedule client updates.
@@ -176,29 +174,29 @@ namespace OpenSim.Region.Environment.Scenes
176 /// </summary> 174 /// </summary>
177 private byte m_updateFlag; 175 private byte m_updateFlag;
178 176
179 protected LLVector3 m_acceleration; 177 protected Vector3 m_acceleration;
180 protected LLVector3 m_angularVelocity; 178 protected Vector3 m_angularVelocity;
181 179
182 //unkown if this will be kept, added as a way of removing the group position from the group class 180 //unkown if this will be kept, added as a way of removing the group position from the group class
183 protected LLVector3 m_groupPosition; 181 protected Vector3 m_groupPosition;
184 protected uint m_localId; 182 protected uint m_localId;
185 protected LLObject.MaterialType m_material = 0; 183 protected Material m_material = 0;
186 protected string m_name; 184 protected string m_name;
187 protected LLVector3 m_offsetPosition; 185 protected Vector3 m_offsetPosition;
188 186
189 // FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out. 187 // FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out.
190 protected SceneObjectGroup m_parentGroup; 188 protected SceneObjectGroup m_parentGroup;
191 protected byte[] m_particleSystem = new byte[0]; 189 protected byte[] m_particleSystem = new byte[0];
192 protected ulong m_regionHandle; 190 protected ulong m_regionHandle;
193 protected LLQuaternion m_rotationOffset; 191 protected Quaternion m_rotationOffset;
194 protected PrimitiveBaseShape m_shape = null; 192 protected PrimitiveBaseShape m_shape = null;
195 protected LLUUID m_uuid; 193 protected UUID m_uuid;
196 protected LLVector3 m_velocity; 194 protected Vector3 m_velocity;
197 195
198 // TODO: Those have to be changed into persistent properties at some later point, 196 // TODO: Those have to be changed into persistent properties at some later point,
199 // or sit-camera on vehicles will break on sim-crossing. 197 // or sit-camera on vehicles will break on sim-crossing.
200 private LLVector3 m_cameraEyeOffset = new LLVector3(0.0f, 0.0f, 0.0f); 198 private Vector3 m_cameraEyeOffset = new Vector3(0.0f, 0.0f, 0.0f);
201 private LLVector3 m_cameraAtOffset = new LLVector3(0.0f, 0.0f, 0.0f); 199 private Vector3 m_cameraAtOffset = new Vector3(0.0f, 0.0f, 0.0f);
202 private bool m_forceMouselook = false; 200 private bool m_forceMouselook = false;
203 201
204 #endregion Fields 202 #endregion Fields
@@ -214,9 +212,9 @@ namespace OpenSim.Region.Environment.Scenes
214 m_TextureAnimation = new byte[0]; 212 m_TextureAnimation = new byte[0];
215 } 213 }
216 214
217 public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, 215 public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, UUID ownerID, uint localID,
218 PrimitiveBaseShape shape, LLVector3 groupPosition, LLVector3 offsetPosition) 216 PrimitiveBaseShape shape, Vector3 groupPosition, Vector3 offsetPosition)
219 : this(regionHandle, parent, ownerID, localID, shape, groupPosition, LLQuaternion.Identity, offsetPosition) 217 : this(regionHandle, parent, ownerID, localID, shape, groupPosition, Quaternion.Identity, offsetPosition)
220 { 218 {
221 } 219 }
222 220
@@ -229,9 +227,9 @@ namespace OpenSim.Region.Environment.Scenes
229 /// <param name="localID"></param> 227 /// <param name="localID"></param>
230 /// <param name="shape"></param> 228 /// <param name="shape"></param>
231 /// <param name="position"></param> 229 /// <param name="position"></param>
232 public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, 230 public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, UUID ownerID, uint localID,
233 PrimitiveBaseShape shape, LLVector3 groupPosition, LLQuaternion rotationOffset, 231 PrimitiveBaseShape shape, Vector3 groupPosition, Quaternion rotationOffset,
234 LLVector3 offsetPosition) 232 Vector3 offsetPosition)
235 { 233 {
236 m_name = "Primitive"; 234 m_name = "Primitive";
237 m_regionHandle = regionHandle; 235 m_regionHandle = regionHandle;
@@ -240,8 +238,8 @@ namespace OpenSim.Region.Environment.Scenes
240 _creationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 238 _creationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
241 _ownerID = ownerID; 239 _ownerID = ownerID;
242 _creatorID = _ownerID; 240 _creatorID = _ownerID;
243 _lastOwnerID = LLUUID.Zero; 241 _lastOwnerID = UUID.Zero;
244 UUID = LLUUID.Random(); 242 UUID = UUID.Random();
245 LocalId = (uint) (localID); 243 LocalId = (uint) (localID);
246 Shape = shape; 244 Shape = shape;
247 // Todo: Add More Object Parameter from above! 245 // Todo: Add More Object Parameter from above!
@@ -254,9 +252,9 @@ namespace OpenSim.Region.Environment.Scenes
254 GroupPosition = groupPosition; 252 GroupPosition = groupPosition;
255 OffsetPosition = offsetPosition; 253 OffsetPosition = offsetPosition;
256 RotationOffset = rotationOffset; 254 RotationOffset = rotationOffset;
257 Velocity = new LLVector3(0, 0, 0); 255 Velocity = new Vector3(0, 0, 0);
258 AngularVelocity = new LLVector3(0, 0, 0); 256 AngularVelocity = new Vector3(0, 0, 0);
259 Acceleration = new LLVector3(0, 0, 0); 257 Acceleration = new Vector3(0, 0, 0);
260 m_TextureAnimation = new byte[0]; 258 m_TextureAnimation = new byte[0];
261 259
262 // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, 260 // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
@@ -264,7 +262,7 @@ namespace OpenSim.Region.Environment.Scenes
264 // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log 262 // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log
265 263
266 _flags = 0; 264 _flags = 0;
267 _flags |= LLObject.ObjectFlags.CreateSelected; 265 _flags |= PrimFlags.CreateSelected;
268 266
269 TrimPermissions(); 267 TrimPermissions();
270 //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo()); 268 //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo());
@@ -282,9 +280,9 @@ namespace OpenSim.Region.Environment.Scenes
282 /// <param name="localID"></param> 280 /// <param name="localID"></param>
283 /// <param name="shape"></param> 281 /// <param name="shape"></param>
284 /// <param name="position"></param> 282 /// <param name="position"></param>
285 public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, int creationDate, LLUUID ownerID, 283 public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, int creationDate, UUID ownerID,
286 LLUUID creatorID, LLUUID lastOwnerID, uint localID, PrimitiveBaseShape shape, 284 UUID creatorID, UUID lastOwnerID, uint localID, PrimitiveBaseShape shape,
287 LLVector3 position, LLQuaternion rotation, uint flags) 285 Vector3 position, Quaternion rotation, uint flags)
288 { 286 {
289 m_regionHandle = regionHandle; 287 m_regionHandle = regionHandle;
290 m_parentGroup = parent; 288 m_parentGroup = parent;
@@ -293,7 +291,7 @@ namespace OpenSim.Region.Environment.Scenes
293 _ownerID = ownerID; 291 _ownerID = ownerID;
294 _creatorID = creatorID; 292 _creatorID = creatorID;
295 _lastOwnerID = lastOwnerID; 293 _lastOwnerID = lastOwnerID;
296 UUID = LLUUID.Random(); 294 UUID = UUID.Random();
297 LocalId = (uint) (localID); 295 LocalId = (uint) (localID);
298 Shape = shape; 296 Shape = shape;
299 _ownershipCost = 0; 297 _ownershipCost = 0;
@@ -307,7 +305,7 @@ namespace OpenSim.Region.Environment.Scenes
307 305
308 // Since we don't store script state, this is only a 'temporary' objectflag now 306 // Since we don't store script state, this is only a 'temporary' objectflag now
309 // If the object is scripted, the script will get loaded and this will be set again 307 // If the object is scripted, the script will get loaded and this will be set again
310 ObjectFlags &= ~(uint)(LLObject.ObjectFlags.Scripted | LLObject.ObjectFlags.Touch); 308 ObjectFlags &= ~(uint)(PrimFlags.Scripted | PrimFlags.Touch);
311 309
312 TrimPermissions(); 310 TrimPermissions();
313 // ApplyPhysics(); 311 // ApplyPhysics();
@@ -326,7 +324,7 @@ namespace OpenSim.Region.Environment.Scenes
326 324
327 /* 325 /*
328 m_queue = (Queue<SceneObjectPart>)info.GetValue("m_queue", typeof(Queue<SceneObjectPart>)); 326 m_queue = (Queue<SceneObjectPart>)info.GetValue("m_queue", typeof(Queue<SceneObjectPart>));
329 m_ids = (List<LLUUID>)info.GetValue("m_ids", typeof(List<LLUUID>)); 327 m_ids = (List<UUID>)info.GetValue("m_ids", typeof(List<UUID>));
330 */ 328 */
331 329
332 //System.Console.WriteLine("SceneObjectPart Deserialize END"); 330 //System.Console.WriteLine("SceneObjectPart Deserialize END");
@@ -336,24 +334,24 @@ namespace OpenSim.Region.Environment.Scenes
336 334
337 #region XML Schema 335 #region XML Schema
338 336
339 private LLUUID _lastOwnerID; 337 private UUID _lastOwnerID;
340 private LLUUID _ownerID; 338 private UUID _ownerID;
341 private LLUUID _groupID; 339 private UUID _groupID;
342 private int _ownershipCost; 340 private int _ownershipCost;
343 private byte _objectSaleType; 341 private byte _objectSaleType;
344 private int _salePrice; 342 private int _salePrice;
345 private uint _category; 343 private uint _category;
346 private Int32 _creationDate; 344 private Int32 _creationDate;
347 private uint _parentID = 0; 345 private uint _parentID = 0;
348 private LLUUID m_sitTargetAvatar = LLUUID.Zero; 346 private UUID m_sitTargetAvatar = UUID.Zero;
349 private uint _baseMask = (uint)PermissionMask.All; 347 private uint _baseMask = (uint)PermissionMask.All;
350 private uint _ownerMask = (uint)PermissionMask.All; 348 private uint _ownerMask = (uint)PermissionMask.All;
351 private uint _groupMask = (uint)PermissionMask.None; 349 private uint _groupMask = (uint)PermissionMask.None;
352 private uint _everyoneMask = (uint)PermissionMask.None; 350 private uint _everyoneMask = (uint)PermissionMask.None;
353 private uint _nextOwnerMask = (uint)PermissionMask.All; 351 private uint _nextOwnerMask = (uint)PermissionMask.All;
354 private LLObject.ObjectFlags _flags = LLObject.ObjectFlags.None; 352 private PrimFlags _flags = 0;
355 353
356 public LLUUID CreatorID { 354 public UUID CreatorID {
357 get 355 get
358 { 356 {
359 return _creatorID; 357 return _creatorID;
@@ -368,7 +366,7 @@ namespace OpenSim.Region.Environment.Scenes
368 /// Exposing this is not particularly good, but it's one of the least evils at the moment to see 366 /// Exposing this is not particularly good, but it's one of the least evils at the moment to see
369 /// folder id from prim inventory item data, since it's not (yet) actually stored with the prim. 367 /// folder id from prim inventory item data, since it's not (yet) actually stored with the prim.
370 /// </summary> 368 /// </summary>
371 public LLUUID FolderID 369 public UUID FolderID
372 { 370 {
373 get { return UUID; } 371 get { return UUID; }
374 set { } // Don't allow assignment, or legacy prims wil b0rk 372 set { } // Don't allow assignment, or legacy prims wil b0rk
@@ -389,10 +387,10 @@ namespace OpenSim.Region.Environment.Scenes
389 public uint ObjectFlags 387 public uint ObjectFlags
390 { 388 {
391 get { return (uint)_flags; } 389 get { return (uint)_flags; }
392 set { _flags = (LLObject.ObjectFlags)value; } 390 set { _flags = (PrimFlags)value; }
393 } 391 }
394 392
395 public LLUUID UUID 393 public UUID UUID
396 { 394 {
397 get { return m_uuid; } 395 get { return m_uuid; }
398 set { m_uuid = value; } 396 set { m_uuid = value; }
@@ -413,7 +411,7 @@ namespace OpenSim.Region.Environment.Scenes
413 public byte Material 411 public byte Material
414 { 412 {
415 get { return (byte) m_material; } 413 get { return (byte) m_material; }
416 set { m_material = (LLObject.MaterialType) value; } 414 set { m_material = (Material)value; }
417 } 415 }
418 416
419 public ulong RegionHandle 417 public ulong RegionHandle
@@ -435,7 +433,7 @@ namespace OpenSim.Region.Environment.Scenes
435 set { m_TextureAnimation = value; } 433 set { m_TextureAnimation = value; }
436 } 434 }
437 435
438 public LLVector3 GroupPosition 436 public Vector3 GroupPosition
439 { 437 {
440 get 438 get
441 { 439 {
@@ -479,10 +477,10 @@ namespace OpenSim.Region.Environment.Scenes
479 477
480 // To move the child prim in respect to the group position and rotation we have to calculate 478 // To move the child prim in respect to the group position and rotation we have to calculate
481 479
482 LLVector3 resultingposition = GetWorldPosition(); 480 Vector3 resultingposition = GetWorldPosition();
483 PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); 481 PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z);
484 LLQuaternion resultingrot = GetWorldRotation(); 482 Quaternion resultingrot = GetWorldRotation();
485 PhysActor.Orientation = new Quaternion(resultingrot.W, resultingrot.X, resultingrot.Y, resultingrot.Z); 483 PhysActor.Orientation = resultingrot;
486 } 484 }
487 485
488 // Tell the physics engines that this prim changed. 486 // Tell the physics engines that this prim changed.
@@ -497,7 +495,7 @@ namespace OpenSim.Region.Environment.Scenes
497 } 495 }
498 } 496 }
499 497
500 public LLVector3 OffsetPosition 498 public Vector3 OffsetPosition
501 { 499 {
502 get { return m_offsetPosition; } 500 get { return m_offsetPosition; }
503 set 501 set
@@ -518,20 +516,17 @@ namespace OpenSim.Region.Environment.Scenes
518 } 516 }
519 } 517 }
520 518
521 public LLQuaternion RotationOffset 519 public Quaternion RotationOffset
522 { 520 {
523 get 521 get
524 { 522 {
525 // We don't want the physics engine mucking up the rotations in a linkset 523 // We don't want the physics engine mucking up the rotations in a linkset
526 if (PhysActor != null && _parentID == 0) 524 if (PhysActor != null && _parentID == 0)
527 { 525 {
528 if (PhysActor.Orientation.x != 0 || PhysActor.Orientation.y != 0 526 if (PhysActor.Orientation.X != 0 || PhysActor.Orientation.Y != 0
529 || PhysActor.Orientation.z != 0 || PhysActor.Orientation.w != 0) 527 || PhysActor.Orientation.Z != 0 || PhysActor.Orientation.W != 0)
530 { 528 {
531 m_rotationOffset.X = PhysActor.Orientation.x; 529 m_rotationOffset = PhysActor.Orientation;
532 m_rotationOffset.Y = PhysActor.Orientation.y;
533 m_rotationOffset.Z = PhysActor.Orientation.z;
534 m_rotationOffset.W = PhysActor.Orientation.w;
535 } 530 }
536 } 531 }
537 return m_rotationOffset; 532 return m_rotationOffset;
@@ -548,14 +543,14 @@ namespace OpenSim.Region.Environment.Scenes
548 // Root prim gets value directly 543 // Root prim gets value directly
549 if (_parentID == 0) 544 if (_parentID == 0)
550 { 545 {
551 PhysActor.Orientation = new Quaternion(value.W, value.X, value.Y, value.Z); 546 PhysActor.Orientation = value;
552 //m_log.Info("[PART]: RO1:" + PhysActor.Orientation.ToString()); 547 //m_log.Info("[PART]: RO1:" + PhysActor.Orientation.ToString());
553 } 548 }
554 else 549 else
555 { 550 {
556 // Child prim we have to calculate it's world rotationwel 551 // Child prim we have to calculate it's world rotationwel
557 LLQuaternion resultingrotation = GetWorldRotation(); 552 Quaternion resultingrotation = GetWorldRotation();
558 PhysActor.Orientation = new Quaternion(resultingrotation.W, resultingrotation.X, resultingrotation.Y, resultingrotation.Z); 553 PhysActor.Orientation = resultingrotation;
559 //m_log.Info("[PART]: RO2:" + PhysActor.Orientation.ToString()); 554 //m_log.Info("[PART]: RO2:" + PhysActor.Orientation.ToString());
560 } 555 }
561 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); 556 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
@@ -571,12 +566,12 @@ namespace OpenSim.Region.Environment.Scenes
571 } 566 }
572 567
573 /// <summary></summary> 568 /// <summary></summary>
574 public LLVector3 Velocity 569 public Vector3 Velocity
575 { 570 {
576 get 571 get
577 { 572 {
578 //if (PhysActor.Velocity.x != 0 || PhysActor.Velocity.y != 0 573 //if (PhysActor.Velocity.X != 0 || PhysActor.Velocity.Y != 0
579 //|| PhysActor.Velocity.z != 0) 574 //|| PhysActor.Velocity.Z != 0)
580 //{ 575 //{
581 if (PhysActor != null) 576 if (PhysActor != null)
582 { 577 {
@@ -605,14 +600,14 @@ namespace OpenSim.Region.Environment.Scenes
605 } 600 }
606 } 601 }
607 602
608 public LLVector3 RotationalVelocity 603 public Vector3 RotationalVelocity
609 { 604 {
610 get { return AngularVelocity; } 605 get { return AngularVelocity; }
611 set { AngularVelocity = value; } 606 set { AngularVelocity = value; }
612 } 607 }
613 608
614 /// <summary></summary> 609 /// <summary></summary>
615 public LLVector3 AngularVelocity 610 public Vector3 AngularVelocity
616 { 611 {
617 get 612 get
618 { 613 {
@@ -626,7 +621,7 @@ namespace OpenSim.Region.Environment.Scenes
626 } 621 }
627 622
628 /// <summary></summary> 623 /// <summary></summary>
629 public LLVector3 Acceleration 624 public Vector3 Acceleration
630 { 625 {
631 get { return m_acceleration; } 626 get { return m_acceleration; }
632 set { m_acceleration = value; } 627 set { m_acceleration = value; }
@@ -718,7 +713,7 @@ namespace OpenSim.Region.Environment.Scenes
718 TriggerScriptChangedEvent(Changed.SHAPE); 713 TriggerScriptChangedEvent(Changed.SHAPE);
719 } 714 }
720 } 715 }
721 public LLVector3 Scale 716 public Vector3 Scale
722 { 717 {
723 get { return m_shape.Scale; } 718 get { return m_shape.Scale; }
724 set 719 set
@@ -754,7 +749,7 @@ namespace OpenSim.Region.Environment.Scenes
754 #region Public Properties with only Get 749 #region Public Properties with only Get
755 750
756 751
757 public LLVector3 AbsolutePosition 752 public Vector3 AbsolutePosition
758 { 753 {
759 get { 754 get {
760 if (IsAttachment) 755 if (IsAttachment)
@@ -763,12 +758,12 @@ namespace OpenSim.Region.Environment.Scenes
763 return m_offsetPosition + m_groupPosition; } 758 return m_offsetPosition + m_groupPosition; }
764 } 759 }
765 760
766 public LLUUID ObjectCreator 761 public UUID ObjectCreator
767 { 762 {
768 get { return _creatorID; } 763 get { return _creatorID; }
769 } 764 }
770 765
771 public LLUUID ObjectOwner 766 public UUID ObjectOwner
772 { 767 {
773 get { return _ownerID; } 768 get { return _ownerID; }
774 } 769 }
@@ -801,29 +796,27 @@ namespace OpenSim.Region.Environment.Scenes
801 796
802 // This sort of sucks, but I'm adding these in to make some of 797 // This sort of sucks, but I'm adding these in to make some of
803 // the mappings more consistant. 798 // the mappings more consistant.
804 public LLVector3 SitTargetPositionLL 799 public Vector3 SitTargetPositionLL
805 { 800 {
806 get { return new LLVector3(m_sitTargetPosition.x, m_sitTargetPosition.y,m_sitTargetPosition.z); } 801 get { return new Vector3(m_sitTargetPosition.X, m_sitTargetPosition.Y,m_sitTargetPosition.Z); }
807 set { m_sitTargetPosition = new Vector3(value.X, value.Y, value.Z); } 802 set { m_sitTargetPosition = value; }
808 } 803 }
809 804
810 public LLQuaternion SitTargetOrientationLL 805 public Quaternion SitTargetOrientationLL
811 { 806 {
812 get 807 get
813 { 808 {
814 return new LLQuaternion( 809 return new Quaternion(
815 m_sitTargetOrientation.x, 810 m_sitTargetOrientation.X,
816 m_sitTargetOrientation.y, 811 m_sitTargetOrientation.Y,
817 m_sitTargetOrientation.z, 812 m_sitTargetOrientation.Z,
818 m_sitTargetOrientation.w 813 m_sitTargetOrientation.W
819 ); 814 );
820 } 815 }
821 816
822 set { m_sitTargetOrientation = new Quaternion(value.W, value.X, value.Y, value.Z); } 817 set { m_sitTargetOrientation = new Quaternion(value.W, value.X, value.Y, value.Z); }
823 } 818 }
824 819
825
826
827 public bool Stopped 820 public bool Stopped
828 { 821 {
829 get { 822 get {
@@ -873,19 +866,19 @@ namespace OpenSim.Region.Environment.Scenes
873 set { _ownershipCost = value; } 866 set { _ownershipCost = value; }
874 } 867 }
875 868
876 public LLUUID GroupID 869 public UUID GroupID
877 { 870 {
878 get { return _groupID; } 871 get { return _groupID; }
879 set { _groupID = value; } 872 set { _groupID = value; }
880 } 873 }
881 874
882 public LLUUID OwnerID 875 public UUID OwnerID
883 { 876 {
884 get { return _ownerID; } 877 get { return _ownerID; }
885 set { _ownerID = value; } 878 set { _ownerID = value; }
886 } 879 }
887 880
888 public LLUUID LastOwnerID 881 public UUID LastOwnerID
889 { 882 {
890 get { return _lastOwnerID; } 883 get { return _lastOwnerID; }
891 set { _lastOwnerID = value; } 884 set { _lastOwnerID = value; }
@@ -921,34 +914,34 @@ namespace OpenSim.Region.Environment.Scenes
921 set { _nextOwnerMask = value; } 914 set { _nextOwnerMask = value; }
922 } 915 }
923 916
924 public libsecondlife.LLObject.ObjectFlags Flags 917 public PrimFlags Flags
925 { 918 {
926 get { return _flags; } 919 get { return _flags; }
927 set { _flags = value; } 920 set { _flags = value; }
928 } 921 }
929 922
930 public LLUUID SitTargetAvatar 923 public UUID SitTargetAvatar
931 { 924 {
932 get { return m_sitTargetAvatar; } 925 get { return m_sitTargetAvatar; }
933 set { m_sitTargetAvatar = value; } 926 set { m_sitTargetAvatar = value; }
934 } 927 }
935 928
936 [XmlIgnore] 929 [XmlIgnore]
937 public virtual LLUUID RegionID 930 public virtual UUID RegionID
938 { 931 {
939 get 932 get
940 { 933 {
941 if (ParentGroup != null && ParentGroup.Scene != null) 934 if (ParentGroup != null && ParentGroup.Scene != null)
942 return ParentGroup.Scene.RegionInfo.RegionID; 935 return ParentGroup.Scene.RegionInfo.RegionID;
943 else 936 else
944 return LLUUID.Zero; 937 return UUID.Zero;
945 } 938 }
946 set {} // read only 939 set {} // read only
947 } 940 }
948 941
949 private LLUUID _parentUUID = LLUUID.Zero; 942 private UUID _parentUUID = UUID.Zero;
950 [XmlIgnore] 943 [XmlIgnore]
951 public LLUUID ParentUUID 944 public UUID ParentUUID
952 { 945 {
953 get 946 get
954 { 947 {
@@ -985,7 +978,7 @@ namespace OpenSim.Region.Environment.Scenes
985 m_updateFlag = 0; 978 m_updateFlag = 0;
986 } 979 }
987 980
988 private void SendObjectPropertiesToClient(LLUUID AgentID) 981 private void SendObjectPropertiesToClient(UUID AgentID)
989 { 982 {
990 List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences(); 983 List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
991 for (int i = 0; i < avatars.Count; i++) 984 for (int i = 0; i < avatars.Count; i++)
@@ -1027,13 +1020,13 @@ namespace OpenSim.Region.Environment.Scenes
1027 1020
1028 #region Public Methods 1021 #region Public Methods
1029 1022
1030 public void AddFlag(LLObject.ObjectFlags flag) 1023 public void AddFlag(PrimFlags flag)
1031 { 1024 {
1032 // LLObject.ObjectFlags prevflag = Flags; 1025 // PrimFlags prevflag = Flags;
1033 //uint objflags = Flags; 1026 //uint objflags = Flags;
1034 if ((ObjectFlags & (uint) flag) == 0) 1027 if ((ObjectFlags & (uint) flag) == 0)
1035 { 1028 {
1036 //Console.WriteLine("Adding flag: " + ((LLObject.ObjectFlags) flag).ToString()); 1029 //Console.WriteLine("Adding flag: " + ((PrimFlags) flag).ToString());
1037 _flags |= flag; 1030 _flags |= flag;
1038 } 1031 }
1039 //uint currflag = (uint)Flags; 1032 //uint currflag = (uint)Flags;
@@ -1091,7 +1084,7 @@ namespace OpenSim.Region.Environment.Scenes
1091 // The flags don't like conversion from uint to byte, so we have to do 1084 // The flags don't like conversion from uint to byte, so we have to do
1092 // it the crappy way. See the above function :( 1085 // it the crappy way. See the above function :(
1093 1086
1094 data[pos] = ConvertScriptUintToByte(pTexAnim.Flags); pos++; 1087 data[pos] = ConvertScriptUintToByte((uint)pTexAnim.Flags); pos++;
1095 data[pos] = (byte)pTexAnim.Face; pos++; 1088 data[pos] = (byte)pTexAnim.Face; pos++;
1096 data[pos] = (byte)pTexAnim.SizeX; pos++; 1089 data[pos] = (byte)pTexAnim.SizeX; pos++;
1097 data[pos] = (byte)pTexAnim.SizeY; pos++; 1090 data[pos] = (byte)pTexAnim.SizeY; pos++;
@@ -1124,19 +1117,17 @@ namespace OpenSim.Region.Environment.Scenes
1124 /// </summary> 1117 /// </summary>
1125 /// <param name="impulsei">Vector force</param> 1118 /// <param name="impulsei">Vector force</param>
1126 /// <param name="localGlobalTF">true for the local frame, false for the global frame</param> 1119 /// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
1127 public void ApplyImpulse(LLVector3 impulsei, bool localGlobalTF) 1120 public void ApplyImpulse(Vector3 impulsei, bool localGlobalTF)
1128 { 1121 {
1129 PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z); 1122 PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z);
1130 1123
1131 if (localGlobalTF) 1124 if (localGlobalTF)
1132 { 1125 {
1133 1126 Quaternion grot = GetWorldRotation();
1134 LLQuaternion grot = GetWorldRotation(); 1127 Quaternion AXgrot = grot;
1135 Quaternion AXgrot = new Quaternion(grot.W,grot.X,grot.Y,grot.Z); 1128 Vector3 AXimpulsei = impulsei;
1136 Vector3 AXimpulsei = new Vector3(impulsei.X, impulsei.Y, impulsei.Z); 1129 Vector3 newimpulse = AXimpulsei * AXgrot;
1137 Vector3 newimpulse = AXgrot * AXimpulsei; 1130 impulse = new PhysicsVector(newimpulse.X, newimpulse.Y, newimpulse.Z);
1138 impulse = new PhysicsVector(newimpulse.x, newimpulse.y, newimpulse.z);
1139
1140 } 1131 }
1141 else 1132 else
1142 { 1133 {
@@ -1155,8 +1146,8 @@ namespace OpenSim.Region.Environment.Scenes
1155 /// <param name="m_physicalPrim"></param> 1146 /// <param name="m_physicalPrim"></param>
1156 public void ApplyPhysics(uint rootObjectFlags, bool m_physicalPrim) 1147 public void ApplyPhysics(uint rootObjectFlags, bool m_physicalPrim)
1157 { 1148 {
1158 bool isPhysical = (((rootObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0) && m_physicalPrim); 1149 bool isPhysical = (((rootObjectFlags & (uint) PrimFlags.Physics) != 0) && m_physicalPrim);
1159 bool isPhantom = ((rootObjectFlags & (uint) LLObject.ObjectFlags.Phantom) != 0); 1150 bool isPhantom = ((rootObjectFlags & (uint) PrimFlags.Phantom) != 0);
1160 1151
1161 // Added clarification.. since A rigid body is an object that you can kick around, etc. 1152 // Added clarification.. since A rigid body is an object that you can kick around, etc.
1162 bool RigidBody = isPhysical && !isPhantom; 1153 bool RigidBody = isPhysical && !isPhantom;
@@ -1167,11 +1158,10 @@ namespace OpenSim.Region.Environment.Scenes
1167 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( 1158 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
1168 Name, 1159 Name,
1169 Shape, 1160 Shape,
1170 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, 1161 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z),
1171 AbsolutePosition.Z),
1172 new PhysicsVector(Scale.X, Scale.Y, Scale.Z), 1162 new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
1173 new Quaternion(RotationOffset.W, RotationOffset.X, 1163 RotationOffset,
1174 RotationOffset.Y, RotationOffset.Z), RigidBody); 1164 RigidBody);
1175 1165
1176 // Basic Physics returns null.. joy joy joy. 1166 // Basic Physics returns null.. joy joy joy.
1177 if (PhysActor != null) 1167 if (PhysActor != null)
@@ -1208,24 +1198,23 @@ namespace OpenSim.Region.Environment.Scenes
1208 /// Duplicates this part. 1198 /// Duplicates this part.
1209 /// </summary> 1199 /// </summary>
1210 /// <returns></returns> 1200 /// <returns></returns>
1211 public SceneObjectPart Copy(uint localID, LLUUID AgentID, LLUUID GroupID, int linkNum, bool userExposed) 1201 public SceneObjectPart Copy(uint localID, UUID AgentID, UUID GroupID, int linkNum, bool userExposed)
1212 { 1202 {
1213 SceneObjectPart dupe = (SceneObjectPart) MemberwiseClone(); 1203 SceneObjectPart dupe = (SceneObjectPart) MemberwiseClone();
1214 dupe.m_shape = m_shape.Copy(); 1204 dupe.m_shape = m_shape.Copy();
1215 dupe.m_regionHandle = m_regionHandle; 1205 dupe.m_regionHandle = m_regionHandle;
1216 if (userExposed) 1206 if (userExposed)
1217 dupe.UUID = LLUUID.Random(); 1207 dupe.UUID = UUID.Random();
1218 1208
1219 dupe.LocalId = localID; 1209 dupe.LocalId = localID;
1220 dupe._ownerID = AgentID; 1210 dupe._ownerID = AgentID;
1221 dupe._groupID = GroupID; 1211 dupe._groupID = GroupID;
1222 dupe.GroupPosition = new LLVector3(GroupPosition.X, GroupPosition.Y, GroupPosition.Z); 1212 dupe.GroupPosition = GroupPosition;
1223 dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z); 1213 dupe.OffsetPosition = OffsetPosition;
1224 dupe.RotationOffset = 1214 dupe.RotationOffset = RotationOffset;
1225 new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W); 1215 dupe.Velocity = Vector3.Zero;
1226 dupe.Velocity = new LLVector3(0, 0, 0); 1216 dupe.Acceleration = Vector3.Zero;
1227 dupe.Acceleration = new LLVector3(0, 0, 0); 1217 dupe.AngularVelocity = Vector3.Zero;
1228 dupe.AngularVelocity = new LLVector3(0, 0, 0);
1229 dupe.ObjectFlags = ObjectFlags; 1218 dupe.ObjectFlags = ObjectFlags;
1230 1219
1231 dupe._ownershipCost = _ownershipCost; 1220 dupe._ownershipCost = _ownershipCost;
@@ -1247,11 +1236,11 @@ namespace OpenSim.Region.Environment.Scenes
1247 1236
1248 if (userExposed) 1237 if (userExposed)
1249 { 1238 {
1250 if (dupe.m_shape.SculptEntry && dupe.m_shape.SculptTexture != LLUUID.Zero) 1239 if (dupe.m_shape.SculptEntry && dupe.m_shape.SculptTexture != UUID.Zero)
1251 { 1240 {
1252 m_parentGroup.Scene.AssetCache.GetAsset(dupe.m_shape.SculptTexture, dupe.SculptTextureCallback, true); 1241 m_parentGroup.Scene.AssetCache.GetAsset(dupe.m_shape.SculptTexture, dupe.SculptTextureCallback, true);
1253 } 1242 }
1254 bool UsePhysics = ((dupe.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); 1243 bool UsePhysics = ((dupe.ObjectFlags & (uint)PrimFlags.Physics) != 0);
1255 dupe.DoPhysicsPropertyUpdate(UsePhysics, true); 1244 dupe.DoPhysicsPropertyUpdate(UsePhysics, true);
1256 } 1245 }
1257 return dupe; 1246 return dupe;
@@ -1260,13 +1249,13 @@ namespace OpenSim.Region.Environment.Scenes
1260 public static SceneObjectPart Create() 1249 public static SceneObjectPart Create()
1261 { 1250 {
1262 SceneObjectPart part = new SceneObjectPart(); 1251 SceneObjectPart part = new SceneObjectPart();
1263 part.UUID = LLUUID.Random(); 1252 part.UUID = UUID.Random();
1264 1253
1265 PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); 1254 PrimitiveBaseShape shape = PrimitiveBaseShape.Create();
1266 part.Shape = shape; 1255 part.Shape = shape;
1267 1256
1268 part.Name = "Primitive"; 1257 part.Name = "Primitive";
1269 part._ownerID = LLUUID.Random(); 1258 part._ownerID = UUID.Random();
1270 1259
1271 return part; 1260 return part;
1272 } 1261 }
@@ -1295,16 +1284,8 @@ namespace OpenSim.Region.Environment.Scenes
1295 /// that's not wholesome. Had to make Scene public 1284 /// that's not wholesome. Had to make Scene public
1296 //PhysActor = null; 1285 //PhysActor = null;
1297 1286
1298 if ((ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) 1287 if ((ObjectFlags & (uint) PrimFlags.Phantom) == 0)
1299 { 1288 {
1300 //PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
1301 //Name,
1302 //Shape,
1303 //new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
1304 //AbsolutePosition.Z),
1305 //new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
1306 //new Quaternion(RotationOffset.W, RotationOffset.X,
1307 //RotationOffset.Y, RotationOffset.Z), UsePhysics);
1308 if (UsePhysics) 1289 if (UsePhysics)
1309 { 1290 {
1310 ParentGroup.Scene.AddPhysicalPrim(1); 1291 ParentGroup.Scene.AddPhysicalPrim(1);
@@ -1339,7 +1320,7 @@ namespace OpenSim.Region.Environment.Scenes
1339 return newobject; 1320 return newobject;
1340 } 1321 }
1341 1322
1342 public LLUUID GetAvatarOnSitTarget() 1323 public UUID GetAvatarOnSitTarget()
1343 { 1324 {
1344 return m_sitTargetAvatar; 1325 return m_sitTargetAvatar;
1345 } 1326 }
@@ -1356,30 +1337,30 @@ namespace OpenSim.Region.Environment.Scenes
1356 1337
1357 public double GetDistanceTo(Vector3 a, Vector3 b) 1338 public double GetDistanceTo(Vector3 a, Vector3 b)
1358 { 1339 {
1359 float dx = a.x - b.x; 1340 float dx = a.X - b.X;
1360 float dy = a.y - b.y; 1341 float dy = a.Y - b.Y;
1361 float dz = a.z - b.z; 1342 float dz = a.Z - b.Z;
1362 return Math.Sqrt(dx * dx + dy * dy + dz * dz); 1343 return Math.Sqrt(dx * dx + dy * dy + dz * dz);
1363 } 1344 }
1364 1345
1365 public uint GetEffectiveObjectFlags() 1346 public uint GetEffectiveObjectFlags()
1366 { 1347 {
1367 LLObject.ObjectFlags f = _flags; 1348 PrimFlags f = _flags;
1368 if (m_parentGroup == null || m_parentGroup.RootPart == this) 1349 if (m_parentGroup == null || m_parentGroup.RootPart == this)
1369 f &= ~(LLObject.ObjectFlags.Touch | LLObject.ObjectFlags.Money); 1350 f &= ~(PrimFlags.Touch | PrimFlags.Money);
1370 1351
1371 return (uint)_flags | (uint)LocalFlags; 1352 return (uint)_flags | (uint)LocalFlags;
1372 } 1353 }
1373 1354
1374 public LLVector3 GetGeometricCenter() 1355 public Vector3 GetGeometricCenter()
1375 { 1356 {
1376 if (PhysActor != null) 1357 if (PhysActor != null)
1377 { 1358 {
1378 return new LLVector3(PhysActor.CenterOfMass.X, PhysActor.CenterOfMass.Y, PhysActor.CenterOfMass.Z); 1359 return new Vector3(PhysActor.CenterOfMass.X, PhysActor.CenterOfMass.Y, PhysActor.CenterOfMass.Z);
1379 } 1360 }
1380 else 1361 else
1381 { 1362 {
1382 return new LLVector3(0, 0, 0); 1363 return new Vector3(0, 0, 0);
1383 } 1364 }
1384 } 1365 }
1385 1366
@@ -1419,16 +1400,16 @@ namespace OpenSim.Region.Environment.Scenes
1419 1400
1420 Dictionary<Guid, TaskInventoryItem> TaskInventory_work = new Dictionary<Guid, TaskInventoryItem>(); 1401 Dictionary<Guid, TaskInventoryItem> TaskInventory_work = new Dictionary<Guid, TaskInventoryItem>();
1421 1402
1422 foreach (LLUUID id in TaskInventory.Keys) 1403 foreach (UUID id in TaskInventory.Keys)
1423 { 1404 {
1424 TaskInventory_work.Add(id.UUID, TaskInventory[id]); 1405 TaskInventory_work.Add(id.Guid, TaskInventory[id]);
1425 } 1406 }
1426 1407
1427 info.AddValue("TaskInventory", TaskInventory_work); 1408 info.AddValue("TaskInventory", TaskInventory_work);
1428 1409
1429 info.AddValue("LastOwnerID", _lastOwnerID.UUID); 1410 info.AddValue("LastOwnerID", _lastOwnerID.Guid);
1430 info.AddValue("OwnerID", _ownerID.UUID); 1411 info.AddValue("OwnerID", _ownerID.Guid);
1431 info.AddValue("GroupID", _groupID.UUID); 1412 info.AddValue("GroupID", _groupID.Guid);
1432 1413
1433 info.AddValue("OwnershipCost", _ownershipCost); 1414 info.AddValue("OwnershipCost", _ownershipCost);
1434 info.AddValue("ObjectSaleType", _objectSaleType); 1415 info.AddValue("ObjectSaleType", _objectSaleType);
@@ -1451,10 +1432,10 @@ namespace OpenSim.Region.Environment.Scenes
1451 info.AddValue("TimeStampLastActivity", TimeStampLastActivity); 1432 info.AddValue("TimeStampLastActivity", TimeStampLastActivity);
1452 1433
1453 info.AddValue("m_updateFlag", m_updateFlag); 1434 info.AddValue("m_updateFlag", m_updateFlag);
1454 info.AddValue("CreatorID", _creatorID.UUID); 1435 info.AddValue("CreatorID", _creatorID.Guid);
1455 1436
1456 info.AddValue("m_inventorySerial", m_inventorySerial); 1437 info.AddValue("m_inventorySerial", m_inventorySerial);
1457 info.AddValue("m_uuid", m_uuid.UUID); 1438 info.AddValue("m_uuid", m_uuid.Guid);
1458 info.AddValue("m_localID", m_localId); 1439 info.AddValue("m_localID", m_localId);
1459 info.AddValue("m_name", m_name); 1440 info.AddValue("m_name", m_name);
1460 info.AddValue("m_flags", _flags); 1441 info.AddValue("m_flags", _flags);
@@ -1503,7 +1484,7 @@ namespace OpenSim.Region.Environment.Scenes
1503 1484
1504 public void GetProperties(IClientAPI client) 1485 public void GetProperties(IClientAPI client)
1505 { 1486 {
1506 client.SendObjectPropertiesReply(LLUUID.Zero, (ulong)_creationDate, _creatorID, LLUUID.Zero, LLUUID.Zero, 1487 client.SendObjectPropertiesReply(UUID.Zero, (ulong)_creationDate, _creatorID, UUID.Zero, UUID.Zero,
1507 _groupID, (short)InventorySerial, _lastOwnerID, UUID, _ownerID, 1488 _groupID, (short)InventorySerial, _lastOwnerID, UUID, _ownerID,
1508 ParentGroup.RootPart.TouchName, new byte[0], ParentGroup.RootPart.SitName, Name, Description, 1489 ParentGroup.RootPart.TouchName, new byte[0], ParentGroup.RootPart.SitName, Name, Description,
1509 ParentGroup.RootPart._ownerMask, ParentGroup.RootPart._nextOwnerMask, ParentGroup.RootPart._groupMask, ParentGroup.RootPart._everyoneMask, 1490 ParentGroup.RootPart._ownerMask, ParentGroup.RootPart._nextOwnerMask, ParentGroup.RootPart._groupMask, ParentGroup.RootPart._everyoneMask,
@@ -1512,13 +1493,13 @@ namespace OpenSim.Region.Environment.Scenes
1512 ParentGroup.RootPart.SalePrice); 1493 ParentGroup.RootPart.SalePrice);
1513 } 1494 }
1514 1495
1515 public LLUUID GetRootPartUUID() 1496 public UUID GetRootPartUUID()
1516 { 1497 {
1517 if (m_parentGroup != null) 1498 if (m_parentGroup != null)
1518 { 1499 {
1519 return m_parentGroup.UUID; 1500 return m_parentGroup.UUID;
1520 } 1501 }
1521 return LLUUID.Zero; 1502 return UUID.Zero;
1522 } 1503 }
1523 1504
1524 /// <summary> 1505 /// <summary>
@@ -1526,63 +1507,40 @@ namespace OpenSim.Region.Environment.Scenes
1526 /// Remember, the Group Position simply gives the position of the group itself 1507 /// Remember, the Group Position simply gives the position of the group itself
1527 /// </summary> 1508 /// </summary>
1528 /// <returns>A Linked Child Prim objects position in world</returns> 1509 /// <returns>A Linked Child Prim objects position in world</returns>
1529 public LLVector3 GetWorldPosition() 1510 public Vector3 GetWorldPosition()
1530 { 1511 {
1531 Quaternion parentRot = new Quaternion( 1512 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
1532 ParentGroup.RootPart.RotationOffset.W, 1513
1533 ParentGroup.RootPart.RotationOffset.X, 1514 Vector3 axPos = OffsetPosition;
1534 ParentGroup.RootPart.RotationOffset.Y,
1535 ParentGroup.RootPart.RotationOffset.Z);
1536
1537 Vector3 axPos
1538 = new Vector3(
1539 OffsetPosition.X,
1540 OffsetPosition.Y,
1541 OffsetPosition.Z);
1542
1543 axPos = parentRot * axPos;
1544 LLVector3 translationOffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z);
1545 return GroupPosition + translationOffsetPosition;
1546 1515
1547 //return (new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z) + AbsolutePosition); 1516 axPos *= parentRot;
1517 Vector3 translationOffsetPosition = axPos;
1518 return GroupPosition + translationOffsetPosition;
1548 } 1519 }
1549 1520
1550 /// <summary> 1521 /// <summary>
1551 /// Gets the rotation of this prim offset by the group rotation 1522 /// Gets the rotation of this prim offset by the group rotation
1552 /// </summary> 1523 /// </summary>
1553 /// <returns></returns> 1524 /// <returns></returns>
1554 public LLQuaternion GetWorldRotation() 1525 public Quaternion GetWorldRotation()
1555 { 1526 {
1556 Quaternion newRot; 1527 Quaternion newRot;
1557 1528
1558 if (this.LinkNum == 0) 1529 if (this.LinkNum == 0)
1559 { 1530 {
1560 newRot = new Quaternion(RotationOffset.W,RotationOffset.X,RotationOffset.Y,RotationOffset.Z); 1531 newRot = RotationOffset;
1561
1562 } 1532 }
1563 else 1533 else
1564 { 1534 {
1565 Quaternion parentRot = new Quaternion( 1535 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
1566 ParentGroup.RootPart.RotationOffset.W, 1536 Quaternion oldRot = RotationOffset;
1567 ParentGroup.RootPart.RotationOffset.X,
1568 ParentGroup.RootPart.RotationOffset.Y,
1569 ParentGroup.RootPart.RotationOffset.Z);
1570
1571 Quaternion oldRot
1572 = new Quaternion(
1573 RotationOffset.W,
1574 RotationOffset.X,
1575 RotationOffset.Y,
1576 RotationOffset.Z);
1577
1578 newRot = parentRot * oldRot; 1537 newRot = parentRot * oldRot;
1579 } 1538 }
1580 return new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
1581 1539
1582 //return new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w); 1540 return newRot;
1583 } 1541 }
1584 1542
1585 public void MoveToTarget(LLVector3 target, float tau) 1543 public void MoveToTarget(Vector3 target, float tau)
1586 { 1544 {
1587 if (tau > 0) 1545 if (tau > 0)
1588 { 1546 {
@@ -1594,7 +1552,7 @@ namespace OpenSim.Region.Environment.Scenes
1594 } 1552 }
1595 } 1553 }
1596 1554
1597 public virtual void OnGrab(LLVector3 offsetPos, IClientAPI remoteClient) 1555 public virtual void OnGrab(Vector3 offsetPos, IClientAPI remoteClient)
1598 { 1556 {
1599 } 1557 }
1600 1558
@@ -1694,7 +1652,7 @@ namespace OpenSim.Region.Environment.Scenes
1694 detobj.nameStr = av.ControllingClient.Name; 1652 detobj.nameStr = av.ControllingClient.Name;
1695 detobj.ownerUUID = av.UUID; 1653 detobj.ownerUUID = av.UUID;
1696 detobj.posVector = av.AbsolutePosition; 1654 detobj.posVector = av.AbsolutePosition;
1697 detobj.rotQuat = new LLQuaternion(av.Rotation.x, av.Rotation.y, av.Rotation.z, av.Rotation.w); 1655 detobj.rotQuat = av.Rotation;
1698 detobj.velVector = av.Velocity; 1656 detobj.velVector = av.Velocity;
1699 detobj.colliderType = 0; 1657 detobj.colliderType = 0;
1700 detobj.groupUUID = av.ControllingClient.ActiveGroupId; 1658 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
@@ -1760,7 +1718,7 @@ namespace OpenSim.Region.Environment.Scenes
1760 detobj.nameStr = av.Name; 1718 detobj.nameStr = av.Name;
1761 detobj.ownerUUID = av.UUID; 1719 detobj.ownerUUID = av.UUID;
1762 detobj.posVector = av.AbsolutePosition; 1720 detobj.posVector = av.AbsolutePosition;
1763 detobj.rotQuat = new LLQuaternion(av.Rotation.x, av.Rotation.y, av.Rotation.z, av.Rotation.w); 1721 detobj.rotQuat = av.Rotation;
1764 detobj.velVector = av.Velocity; 1722 detobj.velVector = av.Velocity;
1765 detobj.colliderType = 0; 1723 detobj.colliderType = 0;
1766 detobj.groupUUID = av.ControllingClient.ActiveGroupId; 1724 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
@@ -1828,7 +1786,7 @@ namespace OpenSim.Region.Environment.Scenes
1828 detobj.nameStr = av.Name; 1786 detobj.nameStr = av.Name;
1829 detobj.ownerUUID = av.UUID; 1787 detobj.ownerUUID = av.UUID;
1830 detobj.posVector = av.AbsolutePosition; 1788 detobj.posVector = av.AbsolutePosition;
1831 detobj.rotQuat = new LLQuaternion(av.Rotation.x, av.Rotation.y, av.Rotation.z, av.Rotation.w); 1789 detobj.rotQuat = av.Rotation;
1832 detobj.velVector = av.Velocity; 1790 detobj.velVector = av.Velocity;
1833 detobj.colliderType = 0; 1791 detobj.colliderType = 0;
1834 detobj.groupUUID = av.ControllingClient.ActiveGroupId; 1792 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
@@ -1857,7 +1815,7 @@ namespace OpenSim.Region.Environment.Scenes
1857 public void PhysicsOutOfBounds(PhysicsVector pos) 1815 public void PhysicsOutOfBounds(PhysicsVector pos)
1858 { 1816 {
1859 m_log.Info("[PHYSICS]: Physical Object went out of bounds."); 1817 m_log.Info("[PHYSICS]: Physical Object went out of bounds.");
1860 RemFlag(LLObject.ObjectFlags.Physics); 1818 RemFlag(PrimFlags.Physics);
1861 DoPhysicsPropertyUpdate(false, true); 1819 DoPhysicsPropertyUpdate(false, true);
1862 //m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); 1820 //m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
1863 } 1821 }
@@ -1866,7 +1824,7 @@ namespace OpenSim.Region.Environment.Scenes
1866 { 1824 {
1867 if (PhysActor != null) 1825 if (PhysActor != null)
1868 { 1826 {
1869 LLVector3 newpos = new LLVector3(PhysActor.Position.GetBytes(), 0); 1827 Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0);
1870 if (newpos.X > 257f || newpos.X < -1f || newpos.Y > 257f || newpos.Y < -1f) 1828 if (newpos.X > 257f || newpos.X < -1f || newpos.Y > 257f || newpos.Y < -1f)
1871 { 1829 {
1872 m_parentGroup.AbsolutePosition = newpos; 1830 m_parentGroup.AbsolutePosition = newpos;
@@ -1880,16 +1838,16 @@ namespace OpenSim.Region.Environment.Scenes
1880 1838
1881 public void PreloadSound(string sound) 1839 public void PreloadSound(string sound)
1882 { 1840 {
1883 // LLUUID ownerID = OwnerID; 1841 // UUID ownerID = OwnerID;
1884 LLUUID objectID = UUID; 1842 UUID objectID = UUID;
1885 LLUUID soundID = LLUUID.Zero; 1843 UUID soundID = UUID.Zero;
1886 1844
1887 if (!LLUUID.TryParse(sound, out soundID)) 1845 if (!UUID.TryParse(sound, out soundID))
1888 { 1846 {
1889 //Trys to fetch sound id from prim's inventory. 1847 //Trys to fetch sound id from prim's inventory.
1890 //Prim's inventory doesn't support non script items yet 1848 //Prim's inventory doesn't support non script items yet
1891 SceneObjectPart op = this; 1849 SceneObjectPart op = this;
1892 foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory) 1850 foreach (KeyValuePair<UUID, TaskInventoryItem> item in op.TaskInventory)
1893 { 1851 {
1894 if (item.Value.Name == sound) 1852 if (item.Value.Name == sound)
1895 { 1853 {
@@ -1908,19 +1866,19 @@ namespace OpenSim.Region.Environment.Scenes
1908 } 1866 }
1909 } 1867 }
1910 1868
1911 public void RemFlag(LLObject.ObjectFlags flag) 1869 public void RemFlag(PrimFlags flag)
1912 { 1870 {
1913 // LLObject.ObjectFlags prevflag = Flags; 1871 // PrimFlags prevflag = Flags;
1914 if ((ObjectFlags & (uint) flag) != 0) 1872 if ((ObjectFlags & (uint) flag) != 0)
1915 { 1873 {
1916 //Console.WriteLine("Removing flag: " + ((LLObject.ObjectFlags)flag).ToString()); 1874 //Console.WriteLine("Removing flag: " + ((PrimFlags)flag).ToString());
1917 _flags &= ~flag; 1875 _flags &= ~flag;
1918 } 1876 }
1919 //System.Console.WriteLine("prev: " + prevflag.ToString() + " curr: " + Flags.ToString()); 1877 //System.Console.WriteLine("prev: " + prevflag.ToString() + " curr: " + Flags.ToString());
1920 //ScheduleFullUpdate(); 1878 //ScheduleFullUpdate();
1921 } 1879 }
1922 1880
1923 public void RemoveScriptEvents(LLUUID scriptid) 1881 public void RemoveScriptEvents(UUID scriptid)
1924 { 1882 {
1925 lock (m_scriptEvents) 1883 lock (m_scriptEvents)
1926 { 1884 {
@@ -1938,13 +1896,13 @@ namespace OpenSim.Region.Environment.Scenes
1938 } 1896 }
1939 1897
1940 /// <summary> 1898 /// <summary>
1941 /// Reset LLUUIDs for this part. This involves generate this part's own LLUUID and 1899 /// Reset UUIDs for this part. This involves generate this part's own UUID and
1942 /// generating new LLUUIDs for all the items in the inventory. 1900 /// generating new UUIDs for all the items in the inventory.
1943 /// </summary> 1901 /// </summary>
1944 /// <param name="linkNum">Link number for the part</param> 1902 /// <param name="linkNum">Link number for the part</param>
1945 public void ResetIDs(int linkNum) 1903 public void ResetIDs(int linkNum)
1946 { 1904 {
1947 UUID = LLUUID.Random(); 1905 UUID = UUID.Random();
1948 LinkNum = linkNum; 1906 LinkNum = linkNum;
1949 1907
1950 ResetInventoryIDs(); 1908 ResetInventoryIDs();
@@ -1954,7 +1912,7 @@ namespace OpenSim.Region.Environment.Scenes
1954 /// Resize this part. 1912 /// Resize this part.
1955 /// </summary> 1913 /// </summary>
1956 /// <param name="scale"></param> 1914 /// <param name="scale"></param>
1957 public void Resize(LLVector3 scale) 1915 public void Resize(Vector3 scale)
1958 { 1916 {
1959 StoreUndoState(); 1917 StoreUndoState();
1960 m_shape.Scale = scale; 1918 m_shape.Scale = scale;
@@ -2032,7 +1990,7 @@ namespace OpenSim.Region.Environment.Scenes
2032 m_parentGroup.ScriptSetPhysicsStatus(UsePhysics); 1990 m_parentGroup.ScriptSetPhysicsStatus(UsePhysics);
2033 } 1991 }
2034 1992
2035 public void SculptTextureCallback(LLUUID textureID, AssetBase texture) 1993 public void SculptTextureCallback(UUID textureID, AssetBase texture)
2036 { 1994 {
2037 if (m_shape.SculptEntry) 1995 if (m_shape.SculptEntry)
2038 { 1996 {
@@ -2073,7 +2031,7 @@ namespace OpenSim.Region.Environment.Scenes
2073 } 2031 }
2074 } 2032 }
2075 2033
2076 public void SendFullUpdateToAllClientsExcept(LLUUID agentID) 2034 public void SendFullUpdateToAllClientsExcept(UUID agentID)
2077 { 2035 {
2078 List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences(); 2036 List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
2079 for (int i = 0; i < avatars.Count; i++) 2037 for (int i = 0; i < avatars.Count; i++)
@@ -2094,7 +2052,7 @@ namespace OpenSim.Region.Environment.Scenes
2094 /// <param name="clientFlags"></param> 2052 /// <param name="clientFlags"></param>
2095 public void SendFullUpdateToClient(IClientAPI remoteClient, uint clientflags) 2053 public void SendFullUpdateToClient(IClientAPI remoteClient, uint clientflags)
2096 { 2054 {
2097 LLVector3 lPos; 2055 Vector3 lPos;
2098 lPos = OffsetPosition; 2056 lPos = OffsetPosition;
2099 SendFullUpdateToClient(remoteClient, lPos, clientflags); 2057 SendFullUpdateToClient(remoteClient, lPos, clientflags);
2100 } 2058 }
@@ -2105,16 +2063,16 @@ namespace OpenSim.Region.Environment.Scenes
2105 /// <param name="remoteClient"></param> 2063 /// <param name="remoteClient"></param>
2106 /// <param name="lPos"></param> 2064 /// <param name="lPos"></param>
2107 /// <param name="clientFlags"></param> 2065 /// <param name="clientFlags"></param>
2108 public void SendFullUpdateToClient(IClientAPI remoteClient, LLVector3 lPos, uint clientFlags) 2066 public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos, uint clientFlags)
2109 { 2067 {
2110 clientFlags &= ~(uint) LLObject.ObjectFlags.CreateSelected; 2068 clientFlags &= ~(uint) PrimFlags.CreateSelected;
2111 2069
2112 if (remoteClient.AgentId == _ownerID) 2070 if (remoteClient.AgentId == _ownerID)
2113 { 2071 {
2114 if ((uint) (_flags & LLObject.ObjectFlags.CreateSelected) != 0) 2072 if ((uint) (_flags & PrimFlags.CreateSelected) != 0)
2115 { 2073 {
2116 clientFlags |= (uint) LLObject.ObjectFlags.CreateSelected; 2074 clientFlags |= (uint) PrimFlags.CreateSelected;
2117 _flags &= ~LLObject.ObjectFlags.CreateSelected; 2075 _flags &= ~PrimFlags.CreateSelected;
2118 } 2076 }
2119 } 2077 }
2120 //bool isattachment = IsAttachment; 2078 //bool isattachment = IsAttachment;
@@ -2140,7 +2098,7 @@ namespace OpenSim.Region.Environment.Scenes
2140 2098
2141 // This causes the Scene to 'poll' physical objects every couple of frames 2099 // This causes the Scene to 'poll' physical objects every couple of frames
2142 // bad, so it's been replaced by an event driven method. 2100 // bad, so it's been replaced by an event driven method.
2143 //if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0) 2101 //if ((ObjectFlags & (uint)PrimFlags.Physics) != 0)
2144 //{ 2102 //{
2145 // Only send the constant terse updates on physical objects! 2103 // Only send the constant terse updates on physical objects!
2146 //ScheduleTerseUpdate(); 2104 //ScheduleTerseUpdate();
@@ -2163,20 +2121,20 @@ namespace OpenSim.Region.Environment.Scenes
2163 if (volume < 0) 2121 if (volume < 0)
2164 volume = 0; 2122 volume = 0;
2165 2123
2166 LLUUID ownerID = _ownerID; 2124 UUID ownerID = _ownerID;
2167 LLUUID objectID = UUID; 2125 UUID objectID = UUID;
2168 LLUUID parentID = GetRootPartUUID(); 2126 UUID parentID = GetRootPartUUID();
2169 LLUUID soundID = LLUUID.Zero; 2127 UUID soundID = UUID.Zero;
2170 LLVector3 position = AbsolutePosition; // region local 2128 Vector3 position = AbsolutePosition; // region local
2171 ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle; 2129 ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle;
2172 2130
2173 //byte flags = 0; 2131 //byte flags = 0;
2174 2132
2175 if (!LLUUID.TryParse(sound, out soundID)) 2133 if (!UUID.TryParse(sound, out soundID))
2176 { 2134 {
2177 // search sound file from inventory 2135 // search sound file from inventory
2178 SceneObjectPart op = this; 2136 SceneObjectPart op = this;
2179 foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory) 2137 foreach (KeyValuePair<UUID, TaskInventoryItem> item in op.TaskInventory)
2180 { 2138 {
2181 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 2139 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
2182 { 2140 {
@@ -2186,7 +2144,7 @@ namespace OpenSim.Region.Environment.Scenes
2186 } 2144 }
2187 } 2145 }
2188 2146
2189 if (soundID == LLUUID.Zero) 2147 if (soundID == UUID.Zero)
2190 return; 2148 return;
2191 2149
2192 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); 2150 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
@@ -2233,11 +2191,11 @@ namespace OpenSim.Region.Environment.Scenes
2233 2191
2234 public void SendTerseUpdateToClient(IClientAPI remoteClient) 2192 public void SendTerseUpdateToClient(IClientAPI remoteClient)
2235 { 2193 {
2236 LLVector3 lPos; 2194 Vector3 lPos;
2237 lPos = OffsetPosition; 2195 lPos = OffsetPosition;
2238 LLQuaternion mRot = RotationOffset; 2196 Quaternion mRot = RotationOffset;
2239 // TODO: I have no idea why we are making this check. This should be sorted out 2197 // TODO: I have no idea why we are making this check. This should be sorted out
2240 if ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) 2198 if ((ObjectFlags & (uint) PrimFlags.Physics) == 0)
2241 { 2199 {
2242 remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity, RotationalVelocity, Shape.State, FromAssetID); 2200 remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity, RotationalVelocity, Shape.State, FromAssetID);
2243 } 2201 }
@@ -2249,9 +2207,9 @@ namespace OpenSim.Region.Environment.Scenes
2249 } 2207 }
2250 } 2208 }
2251 2209
2252 public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) 2210 public void SendTerseUpdateToClient(IClientAPI remoteClient, Vector3 lPos)
2253 { 2211 {
2254 LLQuaternion mRot = RotationOffset; 2212 Quaternion mRot = RotationOffset;
2255 //bool isattachment = IsAttachment; 2213 //bool isattachment = IsAttachment;
2256 //if (LocalId != ParentGroup.RootPart.LocalId) 2214 //if (LocalId != ParentGroup.RootPart.LocalId)
2257 //isattachment = ParentGroup.RootPart.IsAttachment; 2215 //isattachment = ParentGroup.RootPart.IsAttachment;
@@ -2263,7 +2221,7 @@ namespace OpenSim.Region.Environment.Scenes
2263 } 2221 }
2264 else 2222 else
2265 { 2223 {
2266 if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0) 2224 if ((ObjectFlags & (uint)PrimFlags.Physics) == 0)
2267 { 2225 {
2268 remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity, RotationalVelocity, Shape.State, FromAssetID); 2226 remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity, RotationalVelocity, Shape.State, FromAssetID);
2269 } 2227 }
@@ -2296,7 +2254,7 @@ namespace OpenSim.Region.Environment.Scenes
2296 //} 2254 //}
2297 } 2255 }
2298 2256
2299 public void SetAvatarOnSitTarget(LLUUID avatarID) 2257 public void SetAvatarOnSitTarget(UUID avatarID)
2300 { 2258 {
2301 m_sitTargetAvatar = avatarID; 2259 m_sitTargetAvatar = avatarID;
2302 if (ParentGroup != null) 2260 if (ParentGroup != null)
@@ -2352,7 +2310,7 @@ namespace OpenSim.Region.Environment.Scenes
2352 } 2310 }
2353 } 2311 }
2354 2312
2355 public void SetGroup(LLUUID groupID, IClientAPI client) 2313 public void SetGroup(UUID groupID, IClientAPI client)
2356 { 2314 {
2357 _groupID = groupID; 2315 _groupID = groupID;
2358 GetProperties(client); 2316 GetProperties(client);
@@ -2379,7 +2337,7 @@ namespace OpenSim.Region.Environment.Scenes
2379 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); 2337 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
2380 } 2338 }
2381 2339
2382 public void SetScriptEvents(LLUUID scriptid, int events) 2340 public void SetScriptEvents(UUID scriptid, int events)
2383 { 2341 {
2384 // scriptEvents oldparts; 2342 // scriptEvents oldparts;
2385 lock (m_scriptEvents) 2343 lock (m_scriptEvents)
@@ -2399,24 +2357,6 @@ namespace OpenSim.Region.Environment.Scenes
2399 aggregateScriptEvents(); 2357 aggregateScriptEvents();
2400 } 2358 }
2401 2359
2402 // public void SetSitTarget(Vector3 offset, Quaternion orientation)
2403 // {
2404 // m_sitTargetPosition = offset;
2405 // m_sitTargetOrientation = orientation;
2406 // }
2407
2408 // // Utility function so the databases don't have to reference axiom.math
2409 // public void SetSitTargetLL(LLVector3 offset, LLQuaternion orientation)
2410 // {
2411 // if (
2412 // !(offset.X == 0 && offset.Y == 0 && offset.Z == 0 && (orientation.W == 0 || orientation.W == 1) &&
2413 // orientation.X == 0 && orientation.Y == 0 && orientation.Z == 0))
2414 // {
2415 // m_sitTargetPosition = new Vector3(offset.X, offset.Y, offset.Z);
2416 // m_sitTargetOrientation = new Quaternion(orientation.W, orientation.X, orientation.Y, orientation.Z);
2417 // }
2418 // }
2419
2420 /// <summary> 2360 /// <summary>
2421 /// Set the text displayed for this part. 2361 /// Set the text displayed for this part.
2422 /// </summary> 2362 /// </summary>
@@ -2438,9 +2378,9 @@ namespace OpenSim.Region.Environment.Scenes
2438 public void SetText(string text, Vector3 color, double alpha) 2378 public void SetText(string text, Vector3 color, double alpha)
2439 { 2379 {
2440 Color = Color.FromArgb(0xff - (int) (alpha*0xff), 2380 Color = Color.FromArgb(0xff - (int) (alpha*0xff),
2441 (int) (color.x*0xff), 2381 (int) (color.X*0xff),
2442 (int) (color.y*0xff), 2382 (int) (color.Y*0xff),
2443 (int) (color.z*0xff)); 2383 (int) (color.Z*0xff));
2444 SetText(text); 2384 SetText(text);
2445 } 2385 }
2446 2386
@@ -2491,33 +2431,22 @@ namespace OpenSim.Region.Environment.Scenes
2491 2431
2492 2432
2493 EntityIntersection returnresult = new EntityIntersection(); 2433 EntityIntersection returnresult = new EntityIntersection();
2494 Vector3 vAbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); 2434 Vector3 vAbsolutePosition = AbsolutePosition;
2495 2435 Vector3 vScale = Scale;
2496 Vector3 vScale = new Vector3(Scale.X, Scale.Y, Scale.Z);
2497 // Quaternion qRotation =
2498 // new Quaternion(RotationOffset.W, RotationOffset.X, RotationOffset.Y, RotationOffset.Z);
2499
2500
2501 //Quaternion worldRotation = (qRotation*parentrot);
2502 //Matrix3 worldRotM = worldRotation.ToRotationMatrix();
2503
2504
2505 Vector3 rOrigin = iray.Origin; 2436 Vector3 rOrigin = iray.Origin;
2506 Vector3 rDirection = iray.Direction; 2437 Vector3 rDirection = iray.Direction;
2507 2438
2508
2509
2510 //rDirection = rDirection.Normalize(); 2439 //rDirection = rDirection.Normalize();
2511 // Buidling the first part of the Quadratic equation 2440 // Buidling the first part of the Quadratic equation
2512 Vector3 r2ndDirection = rDirection*rDirection; 2441 Vector3 r2ndDirection = rDirection*rDirection;
2513 float itestPart1 = r2ndDirection.x + r2ndDirection.y + r2ndDirection.z; 2442 float itestPart1 = r2ndDirection.X + r2ndDirection.Y + r2ndDirection.Z;
2514 2443
2515 // Buidling the second part of the Quadratic equation 2444 // Buidling the second part of the Quadratic equation
2516 Vector3 tmVal2 = rOrigin - vAbsolutePosition; 2445 Vector3 tmVal2 = rOrigin - vAbsolutePosition;
2517 Vector3 r2Direction = rDirection*2.0f; 2446 Vector3 r2Direction = rDirection*2.0f;
2518 Vector3 tmVal3 = r2Direction*tmVal2; 2447 Vector3 tmVal3 = r2Direction*tmVal2;
2519 2448
2520 float itestPart2 = tmVal3.x + tmVal3.y + tmVal3.z; 2449 float itestPart2 = tmVal3.X + tmVal3.Y + tmVal3.Z;
2521 2450
2522 // Buidling the third part of the Quadratic equation 2451 // Buidling the third part of the Quadratic equation
2523 Vector3 tmVal4 = rOrigin*rOrigin; 2452 Vector3 tmVal4 = rOrigin*rOrigin;
@@ -2528,12 +2457,12 @@ namespace OpenSim.Region.Environment.Scenes
2528 2457
2529 // Set Radius to the largest dimention of the prim 2458 // Set Radius to the largest dimention of the prim
2530 float radius = 0f; 2459 float radius = 0f;
2531 if (vScale.x > radius) 2460 if (vScale.X > radius)
2532 radius = vScale.x; 2461 radius = vScale.X;
2533 if (vScale.y > radius) 2462 if (vScale.Y > radius)
2534 radius = vScale.y; 2463 radius = vScale.Y;
2535 if (vScale.z > radius) 2464 if (vScale.Z > radius)
2536 radius = vScale.z; 2465 radius = vScale.Z;
2537 2466
2538 // the second part of this is the default prim size 2467 // the second part of this is the default prim size
2539 // once we factor in the aabb of the prim we're adding we can 2468 // once we factor in the aabb of the prim we're adding we can
@@ -2544,8 +2473,8 @@ namespace OpenSim.Region.Environment.Scenes
2544 2473
2545 //radius = radius; 2474 //radius = radius;
2546 2475
2547 float itestPart3 = tmVal4.x + tmVal4.y + tmVal4.z + tmVal5.x + tmVal5.y + tmVal5.z - 2476 float itestPart3 = tmVal4.X + tmVal4.Y + tmVal4.Z + tmVal5.X + tmVal5.Y + tmVal5.Z -
2548 (2.0f*(tmVal6.x + tmVal6.y + tmVal6.z + (radius*radius))); 2477 (2.0f*(tmVal6.X + tmVal6.Y + tmVal6.Z + (radius*radius)));
2549 2478
2550 // Yuk Quadradrics.. Solve first 2479 // Yuk Quadradrics.. Solve first
2551 float rootsqr = (itestPart2*itestPart2) - (4.0f*itestPart1*itestPart3); 2480 float rootsqr = (itestPart2*itestPart2) - (4.0f*itestPart1*itestPart3);
@@ -2572,21 +2501,21 @@ namespace OpenSim.Region.Environment.Scenes
2572 // We got an intersection. putting together an EntityIntersection object with the 2501 // We got an intersection. putting together an EntityIntersection object with the
2573 // intersection information 2502 // intersection information
2574 Vector3 ipoint = 2503 Vector3 ipoint =
2575 new Vector3(iray.Origin.x + (iray.Direction.x*root), iray.Origin.y + (iray.Direction.y*root), 2504 new Vector3(iray.Origin.X + (iray.Direction.X*root), iray.Origin.Y + (iray.Direction.Y*root),
2576 iray.Origin.z + (iray.Direction.z*root)); 2505 iray.Origin.Z + (iray.Direction.Z*root));
2577 2506
2578 returnresult.HitTF = true; 2507 returnresult.HitTF = true;
2579 returnresult.ipoint = ipoint; 2508 returnresult.ipoint = ipoint;
2580 2509
2581 // Normal is calculated by the difference and then normalizing the result 2510 // Normal is calculated by the difference and then normalizing the result
2582 Vector3 normalpart = ipoint - vAbsolutePosition; 2511 Vector3 normalpart = ipoint - vAbsolutePosition;
2583 returnresult.normal = normalpart / normalpart.Length; 2512 returnresult.normal = normalpart / normalpart.Length();
2584 2513
2585 // It's funny how the LLVector3 object has a Distance function, but the Axiom.Math object doesn't. 2514 // It's funny how the Vector3 object has a Distance function, but the Axiom.Math object doesn't.
2586 // I can write a function to do it.. but I like the fact that this one is Static. 2515 // I can write a function to do it.. but I like the fact that this one is Static.
2587 2516
2588 LLVector3 distanceConvert1 = new LLVector3(iray.Origin.x, iray.Origin.y, iray.Origin.z); 2517 Vector3 distanceConvert1 = new Vector3(iray.Origin.X, iray.Origin.Y, iray.Origin.Z);
2589 LLVector3 distanceConvert2 = new LLVector3(ipoint.x, ipoint.y, ipoint.z); 2518 Vector3 distanceConvert2 = new Vector3(ipoint.X, ipoint.Y, ipoint.Z);
2590 float distance = (float) Util.GetDistanceTo(distanceConvert1, distanceConvert2); 2519 float distance = (float) Util.GetDistanceTo(distanceConvert1, distanceConvert2);
2591 2520
2592 returnresult.distance = distance; 2521 returnresult.distance = distance;
@@ -2621,21 +2550,21 @@ namespace OpenSim.Region.Environment.Scenes
2621 Vector3 AmBb = new Vector3(0, 0, 0); // Vertex B - Vertex C 2550 Vector3 AmBb = new Vector3(0, 0, 0); // Vertex B - Vertex C
2622 Vector3 cross = new Vector3(); 2551 Vector3 cross = new Vector3();
2623 2552
2624 LLVector3 pos = GetWorldPosition(); 2553 Vector3 pos = GetWorldPosition();
2625 LLQuaternion rot = GetWorldRotation(); 2554 Quaternion rot = GetWorldRotation();
2626 2555
2627 // Variables prefixed with AX are Axiom.Math copies of the LL variety. 2556 // Variables prefixed with AX are Axiom.Math copies of the LL variety.
2628 2557
2629 Quaternion AXrot = new Quaternion(rot.W,rot.X,rot.Y,rot.Z); 2558 Quaternion AXrot = rot;
2630 AXrot.Normalize(); 2559 AXrot.Normalize();
2631 2560
2632 Vector3 AXpos = new Vector3(pos.X, pos.Y, pos.Z); 2561 Vector3 AXpos = pos;
2633 2562
2634 // tScale is the offset to derive the vertex based on the scale. 2563 // tScale is the offset to derive the vertex based on the scale.
2635 // it's different for each vertex because we've got to rotate it 2564 // it's different for each vertex because we've got to rotate it
2636 // to get the world position of the vertex to produce the Oriented Bounding Box 2565 // to get the world position of the vertex to produce the Oriented Bounding Box
2637 2566
2638 Vector3 tScale = new Vector3(); 2567 Vector3 tScale = Vector3.Zero;
2639 2568
2640 Vector3 AXscale = new Vector3(m_shape.Scale.X * 0.5f, m_shape.Scale.Y * 0.5f, m_shape.Scale.Z * 0.5f); 2569 Vector3 AXscale = new Vector3(m_shape.Scale.X * 0.5f, m_shape.Scale.Y * 0.5f, m_shape.Scale.Z * 0.5f);
2641 2570
@@ -2680,97 +2609,97 @@ namespace OpenSim.Region.Environment.Scenes
2680 #endregion 2609 #endregion
2681 2610
2682 #region Plane Decomposition of Oriented Bounding Box 2611 #region Plane Decomposition of Oriented Bounding Box
2683 tScale = new Vector3(AXscale.x, -AXscale.y, AXscale.z); 2612 tScale = new Vector3(AXscale.X, -AXscale.Y, AXscale.Z);
2684 rScale = ((AXrot * tScale)); 2613 rScale = tScale * AXrot;
2685 vertexes[0] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); 2614 vertexes[0] = (new Vector3((pos.X + rScale.X), (pos.Y + rScale.Y), (pos.Z + rScale.Z)));
2686 // vertexes[0].x = pos.X + vertexes[0].x; 2615 // vertexes[0].X = pos.X + vertexes[0].X;
2687 //vertexes[0].y = pos.Y + vertexes[0].y; 2616 //vertexes[0].Y = pos.Y + vertexes[0].Y;
2688 //vertexes[0].z = pos.Z + vertexes[0].z; 2617 //vertexes[0].Z = pos.Z + vertexes[0].Z;
2689 2618
2690 FaceA[0] = vertexes[0]; 2619 FaceA[0] = vertexes[0];
2691 FaceB[3] = vertexes[0]; 2620 FaceB[3] = vertexes[0];
2692 FaceA[4] = vertexes[0]; 2621 FaceA[4] = vertexes[0];
2693 2622
2694 tScale = AXscale; 2623 tScale = AXscale;
2695 rScale = ((AXrot * tScale)); 2624 rScale = tScale * AXrot;
2696 vertexes[1] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); 2625 vertexes[1] = (new Vector3((pos.X + rScale.X), (pos.Y + rScale.Y), (pos.Z + rScale.Z)));
2697 2626
2698 // vertexes[1].x = pos.X + vertexes[1].x; 2627 // vertexes[1].X = pos.X + vertexes[1].X;
2699 // vertexes[1].y = pos.Y + vertexes[1].y; 2628 // vertexes[1].Y = pos.Y + vertexes[1].Y;
2700 //vertexes[1].z = pos.Z + vertexes[1].z; 2629 //vertexes[1].Z = pos.Z + vertexes[1].Z;
2701 2630
2702 FaceB[0] = vertexes[1]; 2631 FaceB[0] = vertexes[1];
2703 FaceA[1] = vertexes[1]; 2632 FaceA[1] = vertexes[1];
2704 FaceC[4] = vertexes[1]; 2633 FaceC[4] = vertexes[1];
2705 2634
2706 tScale = new Vector3(AXscale.x, -AXscale.y, -AXscale.z); 2635 tScale = new Vector3(AXscale.X, -AXscale.Y, -AXscale.Z);
2707 rScale = ((AXrot * tScale)); 2636 rScale = tScale * AXrot;
2708 2637
2709 vertexes[2] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); 2638 vertexes[2] = (new Vector3((pos.X + rScale.X), (pos.Y + rScale.Y), (pos.Z + rScale.Z)));
2710 2639
2711 //vertexes[2].x = pos.X + vertexes[2].x; 2640 //vertexes[2].X = pos.X + vertexes[2].X;
2712 //vertexes[2].y = pos.Y + vertexes[2].y; 2641 //vertexes[2].Y = pos.Y + vertexes[2].Y;
2713 //vertexes[2].z = pos.Z + vertexes[2].z; 2642 //vertexes[2].Z = pos.Z + vertexes[2].Z;
2714 2643
2715 FaceC[0] = vertexes[2]; 2644 FaceC[0] = vertexes[2];
2716 FaceD[3] = vertexes[2]; 2645 FaceD[3] = vertexes[2];
2717 FaceC[5] = vertexes[2]; 2646 FaceC[5] = vertexes[2];
2718 2647
2719 tScale = new Vector3(AXscale.x, AXscale.y, -AXscale.z); 2648 tScale = new Vector3(AXscale.X, AXscale.Y, -AXscale.Z);
2720 rScale = ((AXrot * tScale)); 2649 rScale = tScale * AXrot;
2721 vertexes[3] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); 2650 vertexes[3] = (new Vector3((pos.X + rScale.X), (pos.Y + rScale.Y), (pos.Z + rScale.Z)));
2722 2651
2723 //vertexes[3].x = pos.X + vertexes[3].x; 2652 //vertexes[3].X = pos.X + vertexes[3].X;
2724 // vertexes[3].y = pos.Y + vertexes[3].y; 2653 // vertexes[3].Y = pos.Y + vertexes[3].Y;
2725 // vertexes[3].z = pos.Z + vertexes[3].z; 2654 // vertexes[3].Z = pos.Z + vertexes[3].Z;
2726 2655
2727 FaceD[0] = vertexes[3]; 2656 FaceD[0] = vertexes[3];
2728 FaceC[1] = vertexes[3]; 2657 FaceC[1] = vertexes[3];
2729 FaceA[5] = vertexes[3]; 2658 FaceA[5] = vertexes[3];
2730 2659
2731 tScale = new Vector3(-AXscale.x, AXscale.y, AXscale.z); 2660 tScale = new Vector3(-AXscale.X, AXscale.Y, AXscale.Z);
2732 rScale = ((AXrot * tScale)); 2661 rScale = tScale * AXrot;
2733 vertexes[4] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); 2662 vertexes[4] = (new Vector3((pos.X + rScale.X), (pos.Y + rScale.Y), (pos.Z + rScale.Z)));
2734 2663
2735 // vertexes[4].x = pos.X + vertexes[4].x; 2664 // vertexes[4].X = pos.X + vertexes[4].X;
2736 // vertexes[4].y = pos.Y + vertexes[4].y; 2665 // vertexes[4].Y = pos.Y + vertexes[4].Y;
2737 // vertexes[4].z = pos.Z + vertexes[4].z; 2666 // vertexes[4].Z = pos.Z + vertexes[4].Z;
2738 2667
2739 FaceB[1] = vertexes[4]; 2668 FaceB[1] = vertexes[4];
2740 FaceA[2] = vertexes[4]; 2669 FaceA[2] = vertexes[4];
2741 FaceD[4] = vertexes[4]; 2670 FaceD[4] = vertexes[4];
2742 2671
2743 tScale = new Vector3(-AXscale.x, AXscale.y, -AXscale.z); 2672 tScale = new Vector3(-AXscale.X, AXscale.Y, -AXscale.Z);
2744 rScale = ((AXrot * tScale)); 2673 rScale = tScale * AXrot;
2745 vertexes[5] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); 2674 vertexes[5] = (new Vector3((pos.X + rScale.X), (pos.Y + rScale.Y), (pos.Z + rScale.Z)));
2746 2675
2747 // vertexes[5].x = pos.X + vertexes[5].x; 2676 // vertexes[5].X = pos.X + vertexes[5].X;
2748 // vertexes[5].y = pos.Y + vertexes[5].y; 2677 // vertexes[5].Y = pos.Y + vertexes[5].Y;
2749 // vertexes[5].z = pos.Z + vertexes[5].z; 2678 // vertexes[5].Z = pos.Z + vertexes[5].Z;
2750 2679
2751 FaceD[1] = vertexes[5]; 2680 FaceD[1] = vertexes[5];
2752 FaceC[2] = vertexes[5]; 2681 FaceC[2] = vertexes[5];
2753 FaceB[5] = vertexes[5]; 2682 FaceB[5] = vertexes[5];
2754 2683
2755 tScale = new Vector3(-AXscale.x, -AXscale.y, AXscale.z); 2684 tScale = new Vector3(-AXscale.X, -AXscale.Y, AXscale.Z);
2756 rScale = ((AXrot * tScale)); 2685 rScale = tScale * AXrot;
2757 vertexes[6] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); 2686 vertexes[6] = (new Vector3((pos.X + rScale.X), (pos.Y + rScale.Y), (pos.Z + rScale.Z)));
2758 2687
2759 // vertexes[6].x = pos.X + vertexes[6].x; 2688 // vertexes[6].X = pos.X + vertexes[6].X;
2760 // vertexes[6].y = pos.Y + vertexes[6].y; 2689 // vertexes[6].Y = pos.Y + vertexes[6].Y;
2761 // vertexes[6].z = pos.Z + vertexes[6].z; 2690 // vertexes[6].Z = pos.Z + vertexes[6].Z;
2762 2691
2763 FaceB[2] = vertexes[6]; 2692 FaceB[2] = vertexes[6];
2764 FaceA[3] = vertexes[6]; 2693 FaceA[3] = vertexes[6];
2765 FaceB[4] = vertexes[6]; 2694 FaceB[4] = vertexes[6];
2766 2695
2767 tScale = new Vector3(-AXscale.x, -AXscale.y, -AXscale.z); 2696 tScale = new Vector3(-AXscale.X, -AXscale.Y, -AXscale.Z);
2768 rScale = ((AXrot * tScale)); 2697 rScale = tScale * AXrot;
2769 vertexes[7] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); 2698 vertexes[7] = (new Vector3((pos.X + rScale.X), (pos.Y + rScale.Y), (pos.Z + rScale.Z)));
2770 2699
2771 // vertexes[7].x = pos.X + vertexes[7].x; 2700 // vertexes[7].X = pos.X + vertexes[7].X;
2772 // vertexes[7].y = pos.Y + vertexes[7].y; 2701 // vertexes[7].Y = pos.Y + vertexes[7].Y;
2773 // vertexes[7].z = pos.Z + vertexes[7].z; 2702 // vertexes[7].Z = pos.Z + vertexes[7].Z;
2774 2703
2775 FaceD[2] = vertexes[7]; 2704 FaceD[2] = vertexes[7];
2776 FaceC[3] = vertexes[7]; 2705 FaceC[3] = vertexes[7];
@@ -2786,13 +2715,13 @@ namespace OpenSim.Region.Environment.Scenes
2786 AmBa = FaceA[i] - FaceB[i]; 2715 AmBa = FaceA[i] - FaceB[i];
2787 AmBb = FaceB[i] - FaceC[i]; 2716 AmBb = FaceB[i] - FaceC[i];
2788 2717
2789 cross = AmBb.Cross(AmBa); 2718 cross = Vector3.Cross(AmBb, AmBa);
2790 2719
2791 // normalize the cross product to get the normal. 2720 // normalize the cross product to get the normal.
2792 normals[i] = cross / cross.Length; 2721 normals[i] = cross / cross.Length();
2793 2722
2794 //m_log.Info("[NORMALS]: normals[ " + i + "]" + normals[i].ToString()); 2723 //m_log.Info("[NORMALS]: normals[ " + i + "]" + normals[i].ToString());
2795 //distance[i] = (normals[i].x * AmBa.x + normals[i].y * AmBa.y + normals[i].z * AmBa.z) * -1; 2724 //distance[i] = (normals[i].X * AmBa.X + normals[i].Y * AmBa.Y + normals[i].Z * AmBa.Z) * -1;
2796 } 2725 }
2797 2726
2798 EntityIntersection returnresult = new EntityIntersection(); 2727 EntityIntersection returnresult = new EntityIntersection();
@@ -2862,7 +2791,7 @@ namespace OpenSim.Region.Environment.Scenes
2862 { 2791 {
2863 AmBa = FaceA[i] - FaceB[i]; 2792 AmBa = FaceA[i] - FaceB[i];
2864 AmBb = FaceB[i] - FaceC[i]; 2793 AmBb = FaceB[i] - FaceC[i];
2865 d = normals[i].Dot(FaceB[i]); 2794 d = Vector3.Dot(normals[i], FaceB[i]);
2866 2795
2867 //if (faceCenters) 2796 //if (faceCenters)
2868 //{ 2797 //{
@@ -2870,30 +2799,26 @@ namespace OpenSim.Region.Environment.Scenes
2870 //} 2799 //}
2871 //else 2800 //else
2872 //{ 2801 //{
2873 c = iray.Direction.Dot(normals[i]); 2802 c = Vector3.Dot(iray.Direction, normals[i]);
2874 //} 2803 //}
2875 if (c == 0) 2804 if (c == 0)
2876 continue; 2805 continue;
2877 2806
2878 a = (d - iray.Origin.Dot(normals[i])) / c; 2807 a = (d - Vector3.Dot(iray.Origin, normals[i])) / c;
2879 2808
2880 if (a < 0) 2809 if (a < 0)
2881 continue; 2810 continue;
2882 2811
2883 // If the normal is pointing outside the object 2812 // If the normal is pointing outside the object
2884 2813 if (Vector3.Dot(iray.Direction, normals[i]) < 0 || !frontFacesOnly)
2885
2886
2887 if (iray.Direction.Dot(normals[i]) < 0 || !frontFacesOnly)
2888 { 2814 {
2889
2890 //if (faceCenters) 2815 //if (faceCenters)
2891 //{ //(FaceA[i] + FaceB[i] + FaceC[1] + FaceD[i]) / 4f; 2816 //{ //(FaceA[i] + FaceB[i] + FaceC[1] + FaceD[i]) / 4f;
2892 // q = iray.Origin + a * normals[i]; 2817 // q = iray.Origin + a * normals[i];
2893 //} 2818 //}
2894 //else 2819 //else
2895 //{ 2820 //{
2896 q = iray.Origin + a * iray.Direction; 2821 q = iray.Origin + iray.Direction * a;
2897 //} 2822 //}
2898 2823
2899 float distance2 = (float)GetDistanceTo(q, AXpos); 2824 float distance2 = (float)GetDistanceTo(q, AXpos);
@@ -2913,13 +2838,13 @@ namespace OpenSim.Region.Environment.Scenes
2913 //m_log.Info("[DIST]: " + distance2.ToString()); 2838 //m_log.Info("[DIST]: " + distance2.ToString());
2914 if (faceCenters) 2839 if (faceCenters)
2915 { 2840 {
2916 returnresult.normal = (AXrot * AAfacenormals[i]); 2841 returnresult.normal = AAfacenormals[i] * AXrot;
2917 2842
2918 Vector3 scaleComponent = AAfacenormals[i]; 2843 Vector3 scaleComponent = AAfacenormals[i];
2919 float ScaleOffset = 0.5f; 2844 float ScaleOffset = 0.5f;
2920 if (scaleComponent.x != 0) ScaleOffset = AXscale.x; 2845 if (scaleComponent.X != 0) ScaleOffset = AXscale.X;
2921 if (scaleComponent.y != 0) ScaleOffset = AXscale.y; 2846 if (scaleComponent.Y != 0) ScaleOffset = AXscale.Y;
2922 if (scaleComponent.z != 0) ScaleOffset = AXscale.z; 2847 if (scaleComponent.Z != 0) ScaleOffset = AXscale.Z;
2923 ScaleOffset = Math.Abs(ScaleOffset); 2848 ScaleOffset = Math.Abs(ScaleOffset);
2924 Vector3 offset = returnresult.normal * ScaleOffset; 2849 Vector3 offset = returnresult.normal * ScaleOffset;
2925 returnresult.ipoint = AXpos + offset; 2850 returnresult.ipoint = AXpos + offset;
@@ -2984,7 +2909,7 @@ namespace OpenSim.Region.Environment.Scenes
2984 2909
2985 if (type == 0x30) 2910 if (type == 0x30)
2986 { 2911 {
2987 if (m_shape.SculptEntry && m_shape.SculptTexture != LLUUID.Zero) 2912 if (m_shape.SculptEntry && m_shape.SculptTexture != UUID.Zero)
2988 { 2913 {
2989 //AssetBase tx = m_parentGroup.Scene.getase 2914 //AssetBase tx = m_parentGroup.Scene.getase
2990 m_parentGroup.Scene.AssetCache.GetAsset(m_shape.SculptTexture, SculptTextureCallback, true); 2915 m_parentGroup.Scene.AssetCache.GetAsset(m_shape.SculptTexture, SculptTextureCallback, true);
@@ -2995,13 +2920,13 @@ namespace OpenSim.Region.Environment.Scenes
2995 ScheduleFullUpdate(); 2920 ScheduleFullUpdate();
2996 } 2921 }
2997 2922
2998 public void UpdateGroupPosition(LLVector3 pos) 2923 public void UpdateGroupPosition(Vector3 pos)
2999 { 2924 {
3000 if ((pos.X != GroupPosition.X) || 2925 if ((pos.X != GroupPosition.X) ||
3001 (pos.Y != GroupPosition.Y) || 2926 (pos.Y != GroupPosition.Y) ||
3002 (pos.Z != GroupPosition.Z)) 2927 (pos.Z != GroupPosition.Z))
3003 { 2928 {
3004 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 2929 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
3005 GroupPosition = newPos; 2930 GroupPosition = newPos;
3006 ScheduleTerseUpdate(); 2931 ScheduleTerseUpdate();
3007 } 2932 }
@@ -3015,19 +2940,19 @@ namespace OpenSim.Region.Environment.Scenes
3015 /// 2940 ///
3016 /// </summary> 2941 /// </summary>
3017 /// <param name="pos"></param> 2942 /// <param name="pos"></param>
3018 public void UpdateOffSet(LLVector3 pos) 2943 public void UpdateOffSet(Vector3 pos)
3019 { 2944 {
3020 if ((pos.X != OffsetPosition.X) || 2945 if ((pos.X != OffsetPosition.X) ||
3021 (pos.Y != OffsetPosition.Y) || 2946 (pos.Y != OffsetPosition.Y) ||
3022 (pos.Z != OffsetPosition.Z)) 2947 (pos.Z != OffsetPosition.Z))
3023 { 2948 {
3024 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 2949 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
3025 OffsetPosition = newPos; 2950 OffsetPosition = newPos;
3026 ScheduleTerseUpdate(); 2951 ScheduleTerseUpdate();
3027 } 2952 }
3028 } 2953 }
3029 2954
3030 public void UpdatePermissions(LLUUID AgentID, byte field, uint localID, uint mask, byte addRemTF) 2955 public void UpdatePermissions(UUID AgentID, byte field, uint localID, uint mask, byte addRemTF)
3031 { 2956 {
3032 bool set = addRemTF == 1; 2957 bool set = addRemTF == 1;
3033 2958
@@ -3069,7 +2994,7 @@ namespace OpenSim.Region.Environment.Scenes
3069 bool IsTemporary = false; 2994 bool IsTemporary = false;
3070 bool IsPhantom = false; 2995 bool IsPhantom = false;
3071 // bool castsShadows = false; 2996 // bool castsShadows = false;
3072 bool wasUsingPhysics = ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0); 2997 bool wasUsingPhysics = ((ObjectFlags & (uint) PrimFlags.Physics) != 0);
3073 //bool IsLocked = false; 2998 //bool IsLocked = false;
3074 int i = 0; 2999 int i = 0;
3075 3000
@@ -3091,7 +3016,7 @@ namespace OpenSim.Region.Environment.Scenes
3091 3016
3092 if (usePhysics) 3017 if (usePhysics)
3093 { 3018 {
3094 AddFlag(LLObject.ObjectFlags.Physics); 3019 AddFlag(PrimFlags.Physics);
3095 if (!wasUsingPhysics) 3020 if (!wasUsingPhysics)
3096 { 3021 {
3097 DoPhysicsPropertyUpdate(usePhysics, false); 3022 DoPhysicsPropertyUpdate(usePhysics, false);
@@ -3109,7 +3034,7 @@ namespace OpenSim.Region.Environment.Scenes
3109 } 3034 }
3110 else 3035 else
3111 { 3036 {
3112 RemFlag(LLObject.ObjectFlags.Physics); 3037 RemFlag(PrimFlags.Physics);
3113 if (wasUsingPhysics) 3038 if (wasUsingPhysics)
3114 { 3039 {
3115 DoPhysicsPropertyUpdate(usePhysics, false); 3040 DoPhysicsPropertyUpdate(usePhysics, false);
@@ -3118,7 +3043,7 @@ namespace OpenSim.Region.Environment.Scenes
3118 3043
3119 if (IsPhantom) 3044 if (IsPhantom)
3120 { 3045 {
3121 AddFlag(LLObject.ObjectFlags.Phantom); 3046 AddFlag(PrimFlags.Phantom);
3122 if (PhysActor != null) 3047 if (PhysActor != null)
3123 { 3048 {
3124 m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); 3049 m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
@@ -3128,17 +3053,16 @@ namespace OpenSim.Region.Environment.Scenes
3128 } 3053 }
3129 else 3054 else
3130 { 3055 {
3131 RemFlag(LLObject.ObjectFlags.Phantom); 3056 RemFlag(PrimFlags.Phantom);
3132 if (PhysActor == null) 3057 if (PhysActor == null)
3133 { 3058 {
3134 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( 3059 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
3135 Name, 3060 Name,
3136 Shape, 3061 Shape,
3137 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, 3062 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z),
3138 AbsolutePosition.Z),
3139 new PhysicsVector(Scale.X, Scale.Y, Scale.Z), 3063 new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
3140 new Quaternion(RotationOffset.W, RotationOffset.X, 3064 RotationOffset,
3141 RotationOffset.Y, RotationOffset.Z), usePhysics); 3065 usePhysics);
3142 3066
3143 if (PhysActor != null) 3067 if (PhysActor != null)
3144 { 3068 {
@@ -3175,17 +3099,17 @@ namespace OpenSim.Region.Environment.Scenes
3175 3099
3176 if (IsTemporary) 3100 if (IsTemporary)
3177 { 3101 {
3178 AddFlag(LLObject.ObjectFlags.TemporaryOnRez); 3102 AddFlag(PrimFlags.TemporaryOnRez);
3179 } 3103 }
3180 else 3104 else
3181 { 3105 {
3182 RemFlag(LLObject.ObjectFlags.TemporaryOnRez); 3106 RemFlag(PrimFlags.TemporaryOnRez);
3183 } 3107 }
3184 // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); 3108 // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
3185 ScheduleFullUpdate(); 3109 ScheduleFullUpdate();
3186 } 3110 }
3187 3111
3188 public void UpdateRotation(LLQuaternion rot) 3112 public void UpdateRotation(Quaternion rot)
3189 { 3113 {
3190 if ((rot.X != RotationOffset.X) || 3114 if ((rot.X != RotationOffset.X) ||
3191 (rot.Y != RotationOffset.Y) || 3115 (rot.Y != RotationOffset.Y) ||
@@ -3193,7 +3117,7 @@ namespace OpenSim.Region.Environment.Scenes
3193 (rot.W != RotationOffset.W)) 3117 (rot.W != RotationOffset.W))
3194 { 3118 {
3195 //StoreUndoState(); 3119 //StoreUndoState();
3196 RotationOffset = new LLQuaternion(rot.X, rot.Y, rot.Z, rot.W); 3120 RotationOffset = rot;
3197 ParentGroup.HasGroupChanged = true; 3121 ParentGroup.HasGroupChanged = true;
3198 ScheduleTerseUpdate(); 3122 ScheduleTerseUpdate();
3199 } 3123 }
@@ -3235,9 +3159,9 @@ namespace OpenSim.Region.Environment.Scenes
3235 // Added to handle bug in libsecondlife's TextureEntry.ToBytes() 3159 // Added to handle bug in libsecondlife's TextureEntry.ToBytes()
3236 // not handling RGBA properly. Cycles through, and "fixes" the color 3160 // not handling RGBA properly. Cycles through, and "fixes" the color
3237 // info 3161 // info
3238 public void UpdateTexture(LLObject.TextureEntry tex) 3162 public void UpdateTexture(Primitive.TextureEntry tex)
3239 { 3163 {
3240 //LLColor tmpcolor; 3164 //Color4 tmpcolor;
3241 //for (uint i = 0; i < 32; i++) 3165 //for (uint i = 0; i < 32; i++)
3242 //{ 3166 //{
3243 // if (tex.FaceTextures[i] != null) 3167 // if (tex.FaceTextures[i] != null)
@@ -3291,17 +3215,17 @@ namespace OpenSim.Region.Environment.Scenes
3291 ((AggregateScriptEvents & scriptEvents.touch_start) != 0) 3215 ((AggregateScriptEvents & scriptEvents.touch_start) != 0)
3292 ) 3216 )
3293 { 3217 {
3294 objectflagupdate |= (uint) LLObject.ObjectFlags.Touch; 3218 objectflagupdate |= (uint) PrimFlags.Touch;
3295 } 3219 }
3296 3220
3297 if ((AggregateScriptEvents & scriptEvents.money) != 0) 3221 if ((AggregateScriptEvents & scriptEvents.money) != 0)
3298 { 3222 {
3299 objectflagupdate |= (uint) LLObject.ObjectFlags.Money; 3223 objectflagupdate |= (uint) PrimFlags.Money;
3300 } 3224 }
3301 3225
3302 if (AllowedDrop) 3226 if (AllowedDrop)
3303 { 3227 {
3304 objectflagupdate |= (uint) LLObject.ObjectFlags.AllowInventoryDrop; 3228 objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop;
3305 } 3229 }
3306 3230
3307 if ( 3231 if (
@@ -3326,7 +3250,7 @@ namespace OpenSim.Region.Environment.Scenes
3326 PhysActor.OnCollisionUpdate -= PhysicsCollision; 3250 PhysActor.OnCollisionUpdate -= PhysicsCollision;
3327 } 3251 }
3328 } 3252 }
3329 if ((GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Scripted) != 0) 3253 if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0)
3330 { 3254 {
3331 m_parentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting; 3255 m_parentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting;
3332 } 3256 }
@@ -3335,7 +3259,7 @@ namespace OpenSim.Region.Environment.Scenes
3335 m_parentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting; 3259 m_parentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting;
3336 } 3260 }
3337 3261
3338 LocalFlags=(LLObject.ObjectFlags)objectflagupdate; 3262 LocalFlags=(PrimFlags)objectflagupdate;
3339 3263
3340 if (m_parentGroup != null && m_parentGroup.RootPart == this) 3264 if (m_parentGroup != null && m_parentGroup.RootPart == this)
3341 m_parentGroup.aggregateScriptEvents(); 3265 m_parentGroup.aggregateScriptEvents();
@@ -3343,7 +3267,7 @@ namespace OpenSim.Region.Environment.Scenes
3343 ScheduleFullUpdate(); 3267 ScheduleFullUpdate();
3344 } 3268 }
3345 3269
3346 public int registerTargetWaypoint(LLVector3 target, float tolerance) 3270 public int registerTargetWaypoint(Vector3 target, float tolerance)
3347 { 3271 {
3348 if (m_parentGroup != null) 3272 if (m_parentGroup != null)
3349 { 3273 {
@@ -3360,11 +3284,11 @@ namespace OpenSim.Region.Environment.Scenes
3360 } 3284 }
3361 } 3285 }
3362 3286
3363 public void SetCameraAtOffset(LLVector3 v) { 3287 public void SetCameraAtOffset(Vector3 v) {
3364 m_cameraAtOffset = v; 3288 m_cameraAtOffset = v;
3365 } 3289 }
3366 3290
3367 public void SetCameraEyeOffset(LLVector3 v) { 3291 public void SetCameraEyeOffset(Vector3 v) {
3368 m_cameraEyeOffset = v; 3292 m_cameraEyeOffset = v;
3369 } 3293 }
3370 3294
@@ -3372,11 +3296,11 @@ namespace OpenSim.Region.Environment.Scenes
3372 m_forceMouselook = force; 3296 m_forceMouselook = force;
3373 } 3297 }
3374 3298
3375 public LLVector3 GetCameraAtOffset() { 3299 public Vector3 GetCameraAtOffset() {
3376 return m_cameraAtOffset; 3300 return m_cameraAtOffset;
3377 } 3301 }
3378 3302
3379 public LLVector3 GetCameraEyeOffset() { 3303 public Vector3 GetCameraEyeOffset() {
3380 return m_cameraEyeOffset; 3304 return m_cameraEyeOffset;
3381 } 3305 }
3382 3306