29 using System.Collections.Generic;
32 using System.Reflection;
33 using System.Runtime.Serialization;
34 using System.Security.Permissions;
36 using System.Xml.Serialization;
39 using OpenMetaverse.Packets;
40 using OpenMetaverse.StructuredData;
41 using OpenSim.Framework;
42 using OpenSim.Region.Framework.Interfaces;
43 using OpenSim.Region.Framework.Scenes.Scripting;
44 using OpenSim.Region.Framework.Scenes.Serialization;
45 using OpenSim.Region.PhysicsModules.SharedBase;
48 namespace OpenSim.
Region.Framework.Scenes
119 #endregion Enumerations
126 public const int ALL_SIDES = -1;
129 scriptEvents.collision | scriptEvents.collision_start | scriptEvents.collision_end |
130 scriptEvents.land_collision | scriptEvents.land_collision_start | scriptEvents.land_collision_end
132 private const scriptEvents PhyscicsPhantonSubsEvents = (
133 scriptEvents.land_collision | scriptEvents.land_collision_start | scriptEvents.land_collision_end
135 private const scriptEvents PhyscicsVolumeDtcSubsEvents = (
136 scriptEvents.collision_start | scriptEvents.collision_end
139 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
146 private DOMap m_dynObjs;
155 if (m_dynObjs == null)
156 m_dynObjs =
new DOMap();
175 get {
return Object.ReferenceEquals(ParentGroup.RootPart,
this); }
181 public bool IsSitTargetSet
186 !(SitTargetPosition == Vector3.Zero
187 && (SitTargetOrientation == Quaternion.Identity
188 || SitTargetOrientation.X == 0f && SitTargetOrientation.Y == 0f && SitTargetOrientation.Z == 1f && SitTargetOrientation.W == 0f
189 || SitTargetOrientation.X == 0f && SitTargetOrientation.Y == 0f && SitTargetOrientation.Z == 0f && SitTargetOrientation.W == 0f));
201 public bool BlockGrab {
get; set; }
208 public int[] PayPrice = {-2,-2,-2,-2,-2};
240 public bool SoundQueueing {
get; set; }
251 public byte AttachPoint = 0;
254 public Quaternion AttachRotation = Quaternion.Identity;
265 private Dictionary<int, string> m_CollisionFilter =
new Dictionary<int, string>();
271 private UUID m_fromUserInventoryItemID;
273 public UUID FromUserInventoryItemID
275 get {
return m_fromUserInventoryItemID; }
276 set { m_fromUserInventoryItemID = value; }
286 public byte RotationAxisLocks = 0;
292 public Quaternion SpinOldOrientation = Quaternion.Identity;
294 protected bool m_APIDActive =
false;
295 protected Quaternion m_APIDTarget = Quaternion.Identity;
296 protected float m_APIDDamp = 0;
297 protected float m_APIDStrength = 0;
304 get {
return m_inventory; }
310 public bool IgnoreUndoUpdate =
false;
314 private float m_damage = -1.0f;
315 private byte[] m_TextureAnimation;
316 private byte m_clickAction;
317 private Color m_color = Color.Black;
318 private readonly List<uint> m_lastColliders =
new List<uint>();
319 private int m_linkNum;
321 private int m_scriptAccessPin;
323 private readonly Dictionary<UUID, scriptEvents> m_scriptEvents =
new Dictionary<UUID, scriptEvents>();
324 private string m_sitName = String.Empty;
325 private Quaternion m_sitTargetOrientation = Quaternion.Identity;
326 private Vector3 m_sitTargetPosition;
327 private string m_sitAnimation =
"SIT";
328 private bool m_occupied;
329 private string m_text = String.Empty;
330 private string m_touchName = String.Empty;
333 private bool m_passTouches =
false;
334 private bool m_passCollisions =
false;
342 protected Material m_material = OpenMetaverse.Material.Wood;
347 protected byte[] m_particleSystem = Utils.EmptyBytes;
349 protected Quaternion m_rotationOffset = Quaternion.Identity;
360 protected float m_buoyancy = 0.0f;
365 protected float m_density = 1000.0f;
366 protected float m_gravitymod = 1.0f;
367 protected float m_friction = 0.6f;
368 protected float m_bounce = 0.5f;
371 protected bool m_isSelected =
false;
376 protected string m_mediaUrl;
380 private Vector3 m_cameraEyeOffset;
381 private Vector3 m_cameraAtOffset;
382 private bool m_forceMouselook;
386 private sbyte m_collisionSoundType;
387 private UUID m_collisionSound;
388 private float m_collisionSoundVolume;
390 private int LastColSoundSentTime;
420 m_TextureAnimation = Utils.EmptyBytes;
421 m_particleSystem = Utils.EmptyBytes;
422 Rezzed = DateTime.UtcNow;
423 Description = String.Empty;
424 DynAttrs =
new DAMap();
430 LastColSoundSentTime = Util.EnvironmentTickCount();
443 Quaternion rotationOffset, Vector3 offsetPosition) : this()
447 CreationDate = (int)
Utils.DateTimeToUnixTime(Rezzed);
448 LastOwnerID = CreatorID = OwnerID = ownerID;
449 UUID = UUID.Random();
455 GroupPosition = groupPosition;
456 OffsetPosition = offsetPosition;
457 RotationOffset = rotationOffset;
463 CreateSelected =
true;
468 #endregion Constructors
472 private UUID _lastOwnerID;
473 private UUID _ownerID;
474 private UUID _groupID;
475 private int _ownershipCost;
476 private byte _objectSaleType;
477 private int _salePrice;
478 private uint _category;
479 private Int32 _creationDate;
480 private uint _parentID = 0;
484 private uint _everyoneMask = (uint)PermissionMask.None;
486 private PrimFlags _flags = PrimFlags.None;
487 private DateTime m_expires;
488 private DateTime m_rezzed;
489 private bool m_createSelected =
false;
491 private UUID _creatorID;
492 public UUID CreatorID
494 get {
return _creatorID; }
495 set { _creatorID = value; }
498 private string m_creatorData = string.Empty;
502 public string CreatorData
504 get {
return m_creatorData; }
505 set { m_creatorData = value; }
513 public string CreatorIdentification
517 if (!
string.IsNullOrEmpty(CreatorData))
518 return CreatorID.ToString() +
';' + CreatorData;
520 return CreatorID.ToString();
524 if ((value == null) || (value != null && value == string.Empty))
526 CreatorData = string.Empty;
530 if (!value.Contains(
";"))
532 UUID uuid = UUID.Zero;
533 UUID.TryParse(value, out uuid);
538 string name =
"Unknown User";
539 string[] parts = value.Split(
';');
540 if (parts.Length >= 1)
542 UUID uuid = UUID.Zero;
543 UUID.TryParse(parts[0], out uuid);
546 if (parts.Length >= 2)
548 CreatorData = parts[1];
549 if (!CreatorData.EndsWith(
"/"))
552 if (parts.Length >= 3)
555 CreatorData +=
';' + name;
576 public uint InventorySerial
578 get {
return m_inventory.Serial; }
579 set { m_inventory.Serial = value; }
588 return m_inventory.Items;
591 m_inventory.Items = value;
598 [Obsolete(
"Use Flags property instead")]
599 public uint ObjectFlags
601 get {
return (uint)Flags; }
607 get {
return m_uuid; }
613 if (Inventory != null)
614 Inventory.ResetObjectID();
620 get {
return m_localId; }
628 public virtual string Name
630 get {
return m_name; }
643 public bool PassTouches
645 get {
return m_passTouches; }
648 m_passTouches = value;
650 if (ParentGroup != null)
651 ParentGroup.HasGroupChanged =
true;
655 public bool PassCollisions
657 get {
return m_passCollisions; }
660 m_passCollisions = value;
662 if (ParentGroup != null)
663 ParentGroup.HasGroupChanged =
true;
667 public bool IsSelected
669 get {
return m_isSelected; }
672 m_isSelected = value;
673 if (ParentGroup != null)
674 ParentGroup.PartSelectChanged(value);
680 public Dictionary<int, string> CollisionFilter
682 get {
return m_CollisionFilter; }
685 m_CollisionFilter = value;
689 protected bool APIDActive
691 get {
return m_APIDActive; }
692 set { m_APIDActive = value; }
695 protected Quaternion APIDTarget
697 get {
return m_APIDTarget; }
698 set { m_APIDTarget = value; }
702 protected float APIDDamp
704 get {
return m_APIDDamp; }
705 set { m_APIDDamp = value; }
709 protected float APIDStrength
711 get {
return m_APIDStrength; }
712 set { m_APIDStrength = value; }
715 public ulong RegionHandle
717 get {
return m_regionHandle; }
718 set { m_regionHandle = value; }
721 public int ScriptAccessPin
723 get {
return m_scriptAccessPin; }
724 set { m_scriptAccessPin = (int)value; }
729 get {
return m_PlaySoundMasterPrim; }
730 set { m_PlaySoundMasterPrim = value; }
733 private List<SceneObjectPart> m_PlaySoundSlavePrims =
new List<SceneObjectPart>();
734 public List<SceneObjectPart> PlaySoundSlavePrims
736 get {
return m_PlaySoundSlavePrims; }
737 set { m_PlaySoundSlavePrims = value; }
743 get {
return m_LoopSoundMasterPrim; }
744 set { m_LoopSoundMasterPrim = value; }
747 private List<SceneObjectPart> m_LoopSoundSlavePrims =
new List<SceneObjectPart>();
748 public List<SceneObjectPart> LoopSoundSlavePrims
750 get {
return m_LoopSoundSlavePrims; }
751 set { m_LoopSoundSlavePrims = value; }
754 public Byte[] TextureAnimation
756 get {
return m_TextureAnimation; }
757 set { m_TextureAnimation = value; }
762 get {
return m_particleSystem; }
763 set { m_particleSystem = value; }
767 public DateTime Expires
769 get {
return m_expires; }
770 set { m_expires = value; }
774 public DateTime Rezzed
776 get {
return m_rezzed; }
777 set { m_rezzed = value; }
783 get {
return m_damage; }
784 set { m_damage = value; }
789 m_groupPosition = pos;
797 public Vector3 GroupPosition
806 m_groupPosition = actor.Position;
807 return m_groupPosition;
811 if (ParentGroup.IsAttachment)
813 ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
815 return sp.AbsolutePosition;
819 if (ParentGroup.RootPart !=
this)
820 m_groupPosition = ParentGroup.RootPart.GroupPosition;
821 return m_groupPosition;
825 m_groupPosition = value;
827 if (actor != null && ParentGroup.Scene.PhysicsScene != null)
834 actor.Position = value;
839 actor.Position = GetWorldPosition();
840 actor.Orientation = GetWorldRotation();
844 if (ParentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null)
845 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
849 m_log.ErrorFormat(
"[SCENEOBJECTPART]: GROUP POSITION. {0}", e);
857 m_offsetPosition = pos;
860 public Vector3 OffsetPosition
862 get {
return m_offsetPosition; }
865 Vector3 oldpos = m_offsetPosition;
866 m_offsetPosition = value;
868 if (ParentGroup != null && !ParentGroup.IsDeleted)
873 actor.Position = GetWorldPosition();
874 actor.Orientation = GetWorldRotation();
877 if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null)
878 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
881 if (!m_parentGroup.m_dupeInProgress)
883 List<ScenePresence> avs = ParentGroup.GetSittingAvatars();
888 Vector3 offset = (m_offsetPosition - oldpos);
889 av.AbsolutePosition += offset;
891 av.SendTerseUpdateToAllClients();
896 TriggerScriptChangedEvent(
Changed.POSITION);
900 public Vector3 RelativePosition
906 if (ParentGroup.IsAttachment)
909 return AbsolutePosition;
913 return OffsetPosition;
920 m_rotationOffset = q;
923 public Quaternion RotationOffset
931 if (
ParentID == 0 && (Shape.PCode != 9 || Shape.State == 0) && actor != null)
936 m_rotationOffset = actor.Orientation;
947 return m_rotationOffset;
953 m_rotationOffset = value;
963 actor.Orientation = value;
969 Quaternion resultingrotation = GetWorldRotation();
970 actor.Orientation = resultingrotation;
974 if (ParentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null)
975 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
980 m_log.Error(
"[SCENEOBJECTPART]: ROTATIONOFFSET" + ex.Message);
1003 m_velocity = actor.Velocity;
1012 if (Util.IsNanOrInfinity(value))
1013 m_velocity = Vector3.Zero;
1020 if (actor.IsPhysical)
1022 actor.Velocity = m_velocity;
1023 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
1033 ScheduleTerseUpdate();
1034 ParentGroup.HasGroupChanged =
true;
1043 if ((actor != null) && actor.
IsPhysical && ParentGroup.RootPart ==
this)
1045 m_angularVelocity = actor.RotationalVelocity;
1047 return m_angularVelocity;
1051 if (Util.IsNanOrInfinity(value))
1052 m_angularVelocity = Vector3.Zero;
1054 m_angularVelocity = value;
1057 if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart ==
this && VehicleType == (int)
Vehicle.TYPE_NONE)
1059 actor.RotationalVelocity = m_angularVelocity;
1072 m_acceleration = actor.Acceleration;
1074 return m_acceleration;
1079 if (Util.IsNanOrInfinity(value))
1080 m_acceleration = Vector3.Zero;
1082 m_acceleration = value;
1086 public string Description {
get; set; }
1093 get {
return m_color; }
1094 set { m_color = value; }
1101 if (m_text.Length > 255)
1102 return m_text.Substring(0, 254);
1105 set { m_text = value; }
1109 public string SitName
1111 get {
return m_sitName; }
1112 set { m_sitName = value; }
1115 public string TouchName
1117 get {
return m_touchName; }
1118 set { m_touchName = value; }
1123 get {
return m_linkNum; }
1140 get {
return m_clickAction; }
1143 m_clickAction = value;
1149 get {
return m_shape; }
1159 public Vector3
Scale
1161 get {
return m_shape.Scale; }
1164 if (m_shape != null)
1167 m_shape.Scale = value;
1172 if (ParentGroup.Scene != null)
1174 if (ParentGroup.Scene.PhysicsScene != null)
1176 actor.Size = m_shape.Scale;
1181 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
1187 TriggerScriptChangedEvent(
Changed.SCALE);
1192 public bool UpdatePhysRequired {
get; set; }
1198 public string MediaUrl
1209 if (ParentGroup != null)
1210 ParentGroup.HasGroupChanged =
true;
1214 public bool CreateSelected
1216 get {
return m_createSelected; }
1220 m_createSelected = value;
1227 #region Public Properties with only Get
1229 public Vector3 AbsolutePosition
1233 return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset);
1239 get {
return m_parentGroup; }
1240 private set { m_parentGroup = value; }
1245 get {
return AggregateScriptEvents; }
1248 public Quaternion SitTargetOrientation
1250 get {
return m_sitTargetOrientation; }
1253 m_sitTargetOrientation = value;
1258 public Vector3 SitTargetPosition
1260 get {
return m_sitTargetPosition; }
1263 m_sitTargetPosition = value;
1270 public Vector3 SitTargetPositionLL
1272 get {
return m_sitTargetPosition; }
1273 set { m_sitTargetPosition = value; }
1276 public Quaternion SitTargetOrientationLL
1278 get {
return m_sitTargetOrientation; }
1279 set { m_sitTargetOrientation = value; }
1285 double threshold = 0.02;
1286 return (Math.Abs(
Velocity.X) < threshold &&
1287 Math.Abs(Velocity.Y) < threshold &&
1288 Math.Abs(
Velocity.Z) < threshold &&
1289 Math.Abs(AngularVelocity.X) < threshold &&
1291 Math.Abs(AngularVelocity.Z) < threshold);
1305 get {
return _parentID; }
1306 set { _parentID = value; }
1309 public int CreationDate
1311 get {
return _creationDate; }
1312 set { _creationDate = value; }
1315 public uint Category
1317 get {
return _category; }
1318 set { _category = value; }
1321 public int SalePrice
1323 get {
return _salePrice; }
1324 set { _salePrice = value; }
1327 public byte ObjectSaleType
1329 get {
return _objectSaleType; }
1330 set { _objectSaleType = value; }
1333 public int OwnershipCost
1335 get {
return _ownershipCost; }
1336 set { _ownershipCost = value; }
1341 get {
return _groupID; }
1342 set { _groupID = value; }
1347 get {
return _ownerID; }
1348 set { _ownerID = value; }
1351 public UUID LastOwnerID
1353 get {
return _lastOwnerID; }
1354 set { _lastOwnerID = value; }
1357 public uint BaseMask
1359 get {
return _baseMask; }
1360 set { _baseMask = value; }
1363 public uint OwnerMask
1365 get {
return _ownerMask; }
1366 set { _ownerMask = value; }
1369 public uint GroupMask
1371 get {
return _groupMask; }
1372 set { _groupMask = value; }
1375 public uint EveryoneMask
1377 get {
return _everyoneMask; }
1378 set { _everyoneMask = value; }
1381 public uint NextOwnerMask
1383 get {
return _nextOwnerMask; }
1384 set { _nextOwnerMask = value; }
1395 get {
return _flags; }
1404 public bool IsOccupied
1406 get {
return m_occupied; }
1407 set { m_occupied = value; }
1413 public UUID SitTargetAvatar {
get; set; }
1424 private HashSet<ScenePresence> m_sittingAvatars;
1426 public virtual UUID RegionID
1430 if (ParentGroup.Scene != null)
1431 return ParentGroup.Scene.RegionInfo.RegionID;
1438 private UUID _parentUUID = UUID.Zero;
1440 public UUID ParentUUID
1444 if (ParentGroup != null)
1445 _parentUUID = ParentGroup.UUID;
1450 set { _parentUUID = value; }
1453 public string SitAnimation
1455 get {
return m_sitAnimation; }
1456 set { m_sitAnimation = value; }
1459 public UUID invalidCollisionSoundUUID =
new UUID(
"ffffffff-ffff-ffff-ffff-ffffffffffff");
1464 public sbyte CollisionSoundType
1468 return m_collisionSoundType;
1472 m_collisionSoundType = value;
1474 m_collisionSound = invalidCollisionSoundUUID;
1475 else if (value == 0)
1476 m_collisionSound = UUID.Zero;
1480 public UUID CollisionSound
1482 get {
return m_collisionSound; }
1485 m_collisionSound = value;
1487 if (value == invalidCollisionSoundUUID)
1488 m_collisionSoundType = -1;
1489 else if (value ==
UUID.Zero)
1490 m_collisionSoundType = 0;
1492 m_collisionSoundType = 1;
1494 aggregateScriptEvents();
1498 public float CollisionSoundVolume
1500 get {
return m_collisionSoundVolume; }
1501 set { m_collisionSoundVolume = value; }
1504 public float Buoyancy
1508 if (ParentGroup.RootPart ==
this)
1511 return ParentGroup.RootPart.Buoyancy;
1515 if (ParentGroup != null && ParentGroup.RootPart != null && ParentGroup.RootPart !=
this)
1517 ParentGroup.RootPart.Buoyancy = value;
1521 if (PhysActor != null)
1522 PhysActor.Buoyancy = value;
1526 public Vector3 Force
1530 if (ParentGroup.RootPart ==
this)
1533 return ParentGroup.RootPart.Force;
1538 if (ParentGroup != null && ParentGroup.RootPart != null && ParentGroup.RootPart !=
this)
1540 ParentGroup.RootPart.Force = value;
1544 if (PhysActor != null)
1545 PhysActor.Force = value;
1549 public Vector3 Torque
1553 if (ParentGroup.RootPart ==
this)
1556 return ParentGroup.RootPart.Torque;
1561 if (ParentGroup != null && ParentGroup.RootPart != null && ParentGroup.RootPart !=
this)
1563 ParentGroup.RootPart.Torque = value;
1567 if (PhysActor != null)
1568 PhysActor.Torque = value;
1574 get {
return (byte)m_material; }
1577 if (value >= 0 && value <= (byte)SOPMaterialData.MaxMaterial)
1579 bool update =
false;
1587 if (m_friction != SOPMaterialData.friction(m_material))
1590 m_friction = SOPMaterialData.friction(m_material);
1593 if (m_bounce != SOPMaterialData.bounce(m_material))
1596 m_bounce = SOPMaterialData.bounce(m_material);
1601 if (PhysActor != null)
1603 PhysActor.SetMaterial((int)value);
1605 if(ParentGroup != null)
1606 ParentGroup.HasGroupChanged =
true;
1607 ScheduleFullUpdateIfNone();
1608 UpdatePhysRequired =
true;
1615 private bool HasMesh()
1617 if (Shape != null && (Shape.SculptType == (byte)
SculptType.Mesh))
1627 if (Shape != null && (Shape.SculptType == (byte)
SculptType.Mesh))
1630 type = (byte)PhysShapeType.prim;
1636 public bool UsesComplexCost
1640 byte pst = PhysicsShapeType;
1641 if(pst == (byte) PhysShapeType.none || pst == (byte)
PhysShapeType.convex || HasMesh())
1648 public float PhysicsCost
1652 if(PhysicsShapeType == (byte)PhysShapeType.none)
1656 if (PhysActor != null)
1657 cost = PhysActor.PhysicsCost;
1662 cost *= (1.0f + 0.01333f *
Scale.LengthSquared());
1668 public float StreamingCost
1673 if (PhysActor != null)
1674 cost = PhysActor.StreamCost;
1682 public float SimulationCost
1694 public byte PhysicsShapeType
1696 get {
return m_physicsShapeType; }
1699 byte oldv = m_physicsShapeType;
1701 if (value >= 0 && value <= (byte)PhysShapeType.convex)
1703 if (value == (byte)PhysShapeType.none && ParentGroup != null && ParentGroup.RootPart ==
this)
1704 m_physicsShapeType = DefaultPhysicsShapeType();
1706 m_physicsShapeType = value;
1709 m_physicsShapeType = DefaultPhysicsShapeType();
1711 if (m_physicsShapeType != oldv && ParentGroup != null)
1715 if (PhysActor != null)
1717 ParentGroup.Scene.RemovePhysicalPrim(1);
1718 RemoveFromPhysics();
1722 else if (PhysActor == null)
1724 ApplyPhysics((uint)Flags, VolumeDetectActive,
false);
1725 UpdatePhysicsSubscribedEvents();
1729 PhysActor.PhysicsShapeType = m_physicsShapeType;
1734 if (ParentGroup != null)
1735 ParentGroup.HasGroupChanged =
true;
1738 if (m_physicsShapeType != value)
1740 UpdatePhysRequired =
true;
1745 public float Density
1747 get {
return m_density; }
1750 if (value >=1 && value <= 22587.0)
1753 UpdatePhysRequired =
true;
1756 ScheduleFullUpdateIfNone();
1758 if (ParentGroup != null)
1759 ParentGroup.HasGroupChanged =
true;
1763 pa.Density = Density;
1767 public float GravityModifier
1769 get {
return m_gravitymod; }
1772 if( value >= -1 && value <=28.0f)
1774 m_gravitymod = value;
1775 UpdatePhysRequired =
true;
1778 ScheduleFullUpdateIfNone();
1780 if (ParentGroup != null)
1781 ParentGroup.HasGroupChanged =
true;
1785 pa.GravModifier = GravityModifier;
1789 public float Friction
1791 get {
return m_friction; }
1794 if (value >= 0 && value <= 255.0f)
1797 UpdatePhysRequired =
true;
1800 ScheduleFullUpdateIfNone();
1802 if (ParentGroup != null)
1803 ParentGroup.HasGroupChanged =
true;
1807 pa.Friction = Friction;
1811 public float Restitution
1813 get {
return m_bounce; }
1816 if (value >= 0 && value <= 1.0f)
1819 UpdatePhysRequired =
true;
1822 ScheduleFullUpdateIfNone();
1824 if (ParentGroup != null)
1825 ParentGroup.HasGroupChanged =
true;
1829 pa.Restitution = Restitution;
1834 #endregion Public Properties with only Get
1836 private uint ApplyMask(uint val,
bool set, uint mask)
1844 return val &= ~mask;
1853 UpdateFlag = UpdateRequired.NONE;
1862 client.SendObjectPropertiesReply(
this);
1889 #region Public Methods
1893 Expires = DateTime.Now +
new TimeSpan(600000000);
1899 if ((Flags & flag) == 0)
1912 m_particleSystem = pSystem.GetBytes();
1917 m_particleSystem =
new byte[0];
1924 if (pTexAnim.Flags ==
Primitive.TextureAnimMode.ANIM_OFF)
1926 data = Utils.EmptyBytes;
1930 data =
new byte[16];
1936 data[pos] = ConvertScriptUintToByte((uint)pTexAnim.Flags); pos++;
1937 data[pos] = (byte)pTexAnim.Face; pos++;
1938 data[pos] = (byte)pTexAnim.SizeX; pos++;
1939 data[pos] = (byte)pTexAnim.SizeY; pos++;
1941 Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos);
1942 Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4);
1943 Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8);
1946 m_TextureAnimation = data;
1956 ParentGroup.Scene.ForEachRootClient(delegate(
IClientAPI client)
1958 client.SendAttachedSoundGainChange(
UUID, (float)volume);
1971 Vector3 impulse = impulsei;
1975 Quaternion grot = GetWorldRotation();
1976 Quaternion AXgrot = grot;
1977 Vector3 AXimpulsei = impulsei;
1978 Vector3 newimpulse = AXimpulsei * AXgrot;
1979 impulse = newimpulse;
1982 if (ParentGroup != null)
1984 ParentGroup.applyImpulse(impulse);
1991 if (ParentGroup == null || ParentGroup.IsDeleted)
1994 if (ParentGroup.IsAttachment)
2009 pVel = pVel * GetWorldRotation();
2012 ParentGroup.Velocity = pVel;
2018 if (ParentGroup == null || ParentGroup.IsDeleted)
2021 if (ParentGroup.IsAttachment)
2036 pAngVel = pAngVel * GetWorldRotation();
2039 root.AngularVelocity = pAngVel;
2052 Vector3 impulse = impulsei;
2056 Quaternion grot = GetWorldRotation();
2057 Quaternion AXgrot = grot;
2058 Vector3 AXimpulsei = impulsei;
2059 Vector3 newimpulse = AXimpulsei * AXgrot;
2060 impulse = newimpulse;
2063 ParentGroup.ApplyAngularImpulse(impulse);
2077 Vector3 torque = torquei;
2087 torque *= GetWorldRotation();
2100 public void ApplyPhysics(uint _ObjectFlags,
bool _VolumeDetectActive,
bool building)
2102 VolumeDetectActive = _VolumeDetectActive;
2104 if (!ParentGroup.Scene.CollidablePrims)
2110 bool isPhysical = (_ObjectFlags & (uint)
PrimFlags.Physics) != 0;
2111 bool isPhantom = (_ObjectFlags & (uint)
PrimFlags.Phantom) != 0;
2113 if (_VolumeDetectActive)
2118 DoPhysicsPropertyUpdate(isPhysical,
true);
2122 if ((!isPhantom || isPhysical || _VolumeDetectActive)
2123 && !ParentGroup.IsAttachmentCheckFull()
2124 && !(Shape.PathCurve == (byte)
Extrusion.Flexible))
2126 AddToPhysics(isPhysical, isPhantom, building, isPhysical);
2127 UpdatePhysicsSubscribedEvents();
2137 if ((indata & 1) != 0) outdata |= (byte)TextureAnimFlags.ANIM_ON;
2138 if ((indata & 2) != 0) outdata |= (byte)TextureAnimFlags.LOOP;
2139 if ((indata & 4) != 0) outdata |= (byte)TextureAnimFlags.REVERSE;
2140 if ((indata & 8) != 0) outdata |= (byte)TextureAnimFlags.PING_PONG;
2141 if ((indata & 16) != 0) outdata |= (byte)TextureAnimFlags.SMOOTH;
2142 if ((indata & 32) != 0) outdata |= (byte)TextureAnimFlags.ROTATE;
2143 if ((indata & 64) != 0) outdata |= (byte)TextureAnimFlags.SCALE;
2163 dupe.m_shape = m_shape.Copy();
2164 dupe.m_regionHandle = m_regionHandle;
2166 dupe.UUID = UUID.Random();
2168 dupe.PhysActor = null;
2170 dupe.OwnerID = AgentID;
2171 dupe.GroupID = GroupID;
2172 dupe.GroupPosition = GroupPosition;
2173 dupe.OffsetPosition = OffsetPosition;
2174 dupe.RotationOffset = RotationOffset;
2180 dupe.OwnershipCost = OwnershipCost;
2181 dupe.ObjectSaleType = ObjectSaleType;
2182 dupe.SalePrice = SalePrice;
2183 dupe.Category = Category;
2184 dupe.m_rezzed = m_rezzed;
2186 dupe.m_UndoRedo = null;
2187 dupe.m_isSelected =
false;
2189 dupe.IgnoreUndoUpdate =
false;
2190 dupe.Undoing =
false;
2197 dupe.ResetIDs(linkNum);
2198 dupe.m_inventory.HasInventoryChanged =
true;
2202 dupe.m_inventory.HasInventoryChanged = m_inventory.HasInventoryChanged;
2206 dupe.LocalId = plocalID;
2209 dupe.LastOwnerID = OwnerID;
2211 byte[] extraP =
new byte[Shape.ExtraParams.Length];
2212 Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
2213 dupe.Shape.ExtraParams = extraP;
2215 dupe.m_sittingAvatars =
new HashSet<ScenePresence>();
2218 dupe.KeyframeMotion = null;
2219 dupe.PayPrice = (
int[])PayPrice.Clone();
2221 dupe.DynAttrs.CopyFrom(DynAttrs);
2232 bool UsePhysics = ((dupe.Flags & PrimFlags.Physics) != 0);
2233 dupe.DoPhysicsPropertyUpdate(UsePhysics,
true);
2238 dupe.PhysActor.LocalID = plocalID;
2240 ParentGroup.Scene.EventManager.TriggerOnSceneObjectPartCopy(dupe,
this, userExposed);
2279 jointType = PhysicsJointType.Hinge;
2281 else if (IsBallJoint())
2283 jointType = PhysicsJointType.Ball;
2287 jointType = PhysicsJointType.Ball;
2290 List<string> bodyNames =
new List<string>();
2291 string RawParams = Description;
2292 string[] jointParams = RawParams.Split(
" ".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);
2293 string trackedBodyName = null;
2294 if (jointParams.Length >= 2)
2296 for (
int iBodyName = 0; iBodyName < 2; iBodyName++)
2298 string bodyName = jointParams[iBodyName];
2299 bodyNames.Add(bodyName);
2300 if (bodyName !=
"NULL")
2302 if (trackedBodyName == null)
2304 trackedBodyName = bodyName;
2310 SceneObjectPart trackedBody = ParentGroup.Scene.GetSceneObjectPart(trackedBodyName);
2311 Quaternion localRotation = Quaternion.Identity;
2312 if (trackedBody != null)
2314 localRotation = Quaternion.Inverse(trackedBody.RotationOffset) * this.RotationOffset;
2323 joint = ParentGroup.Scene.PhysicsScene.RequestJointCreation(Name, jointType,
2325 this.RotationOffset,
2331 if (trackedBody == null)
2333 ParentGroup.Scene.jointErrorMessage(joint,
"warning: tracked body name not found! joint location will not be updated properly. joint: " + Name);
2348 ParentGroup.Scene.PhysicsScene.RequestJointDeletion(Name);
2364 if (ParentGroup.Scene == null)
2367 if (!ParentGroup.Scene.PhysicalPrims && UsePhysics)
2372 DoPhysicsPropertyUpdateForNinjaJoint(UsePhysics, isNew);
2386 ParentGroup.Scene.RemovePhysicalPrim(1);
2393 if (pa.
Phantom && !VolumeDetectActive)
2395 RemoveFromPhysics();
2399 pa.IsPhysical = UsePhysics;
2400 pa.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
2401 pa.OnOutOfBounds -= PhysicsOutOfBounds;
2403 if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
2406 ParentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(pa);
2412 pa.IsPhysical = UsePhysics;
2416 if (ParentGroup.RootPart.KeyframeMotion != null)
2417 ParentGroup.RootPart.KeyframeMotion.Stop();
2418 ParentGroup.RootPart.KeyframeMotion = null;
2419 ParentGroup.Scene.AddPhysicalPrim(1);
2421 PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
2422 PhysActor.OnOutOfBounds += PhysicsOutOfBounds;
2426 PhysicsActor parentPa = ParentGroup.RootPart.PhysActor;
2428 if (parentPa != null)
2436 bool phan = ((Flags & PrimFlags.Phantom) != 0);
2443 if (VolumeDetectActive)
2444 pa.SetVolumeDetect(1);
2446 pa.SetVolumeDetect(0);
2454 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
2477 if (ParentGroup.IsDeleted)
2480 return ParentGroup.RootPart.DIE_AT_EDGE;
2485 if (ParentGroup.IsDeleted)
2488 return ParentGroup.RootPart.RETURN_AT_EDGE;
2493 if (ParentGroup.IsDeleted)
2496 ParentGroup.RootPart.RETURN_AT_EDGE = p;
2501 if (ParentGroup.IsDeleted)
2503 StatusSandboxPos = ParentGroup.RootPart.AbsolutePosition;
2504 ParentGroup.RootPart.StatusSandbox = p;
2509 if (ParentGroup.IsDeleted)
2512 return ParentGroup.RootPart.StatusSandbox;
2517 if (!ParentGroup.IsDeleted)
2518 return ParentGroup.GetAxisRotation(axis);
2525 float dx = a.X - b.X;
2526 float dy = a.Y - b.Y;
2527 float dz = a.Z - b.Z;
2528 return Math.Sqrt(dx * dx + dy * dy + dz * dz);
2539 return (uint)Flags | (uint)LocalFlags;
2548 if (ParentGroup.IsDeleted)
2549 return new Vector3(0, 0, 0);
2551 return ParentGroup.GetGeometricCenter();
2566 if (ParentGroup.RootPart ==
this)
2568 if (ParentGroup.IsDeleted)
2569 return AbsolutePosition;
2570 return ParentGroup.GetCenterOfMass();
2577 Vector3 tmp = pa.CenterOfMass;
2581 return AbsolutePosition;
2590 Vector3 tmp = pa.CenterOfMass;
2594 return AbsolutePosition;
2615 ret = GroupPosition;
2621 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
2622 Vector3 translationOffsetPosition = OffsetPosition * parentRot;
2623 ret = ParentGroup.AbsolutePosition + translationOffsetPosition;
2636 if (this.LinkNum == 0 || this.LinkNum == 1)
2638 newRot = RotationOffset;
2644 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
2645 Quaternion oldRot = RotationOffset;
2646 newRot = parentRot * oldRot;
2656 ParentGroup.MoveToTarget(target, tau);
2672 ParentGroup.SetHoverHeight(height, hoverType, tau);
2677 ParentGroup.SetHoverHeight(0f, PIDHoverType.Ground, 0f);
2686 if(CollisionFilter.Count == 0)
2689 if (CollisionFilter.ContainsValue(objectID.ToString()) ||
2690 CollisionFilter.ContainsValue(objectID.ToString() + objectName) ||
2691 CollisionFilter.ContainsValue(
UUID.Zero.ToString() + objectName))
2693 if (CollisionFilter.ContainsKey(1))
2698 if (CollisionFilter.ContainsKey(1))
2707 detobj.keyUUID = obj.UUID;
2708 detobj.nameStr = obj.Name;
2709 detobj.ownerUUID = obj.OwnerID;
2710 detobj.posVector = obj.AbsolutePosition;
2711 detobj.rotQuat = obj.GetWorldRotation();
2712 detobj.velVector = obj.Velocity;
2713 detobj.colliderType = 0;
2714 detobj.groupUUID = obj.GroupID;
2715 detobj.linkNumber = LinkNum;
2723 detobj.keyUUID = av.UUID;
2724 detobj.nameStr = av.ControllingClient.Name;
2725 detobj.ownerUUID = av.UUID;
2726 detobj.posVector = av.AbsolutePosition;
2727 detobj.rotQuat = av.Rotation;
2728 detobj.velVector = av.Velocity;
2729 detobj.colliderType = 0;
2730 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
2731 detobj.linkNumber = LinkNum;
2739 detobj.keyUUID = UUID.Zero;
2740 detobj.nameStr =
"";
2741 detobj.ownerUUID = UUID.Zero;
2742 detobj.posVector = ParentGroup.RootPart.AbsolutePosition;
2743 detobj.rotQuat = Quaternion.Identity;
2744 detobj.velVector = Vector3.Zero;
2745 detobj.colliderType = 0;
2746 detobj.groupUUID = UUID.Zero;
2747 detobj.linkNumber = LinkNum;
2752 private ColliderArgs CreateColliderArgs(SceneObjectPart dest, List<uint> colliders)
2755 List<DetectedObject> colliding =
new List<DetectedObject>();
2756 foreach (uint localId
in colliders)
2761 SceneObjectPart obj = ParentGroup.Scene.GetSceneObjectPart(localId);
2764 if (!dest.CollisionFilteredOut(obj.UUID, obj.Name))
2765 colliding.Add(CreateDetObject(obj));
2769 ScenePresence av = ParentGroup.Scene.GetScenePresence(localId);
2770 if (av != null && (!av.IsChildAgent))
2772 if (!dest.CollisionFilteredOut(av.UUID, av.Name))
2773 colliding.Add(CreateDetObject(av));
2778 colliderArgs.Colliders = colliding;
2780 return colliderArgs;
2783 private delegate
void ScriptCollidingNotification(uint localID,
ColliderArgs message);
2785 private void SendCollisionEvent(
scriptEvents ev, List<uint> colliders, ScriptCollidingNotification notify)
2787 bool sendToRoot =
false;
2790 if (colliders.Count > 0)
2792 if ((ScriptEvents & ev) != 0)
2794 CollidingMessage = CreateColliderArgs(
this, colliders);
2796 if (CollidingMessage.
Colliders.Count > 0)
2797 notify(LocalId, CollidingMessage);
2804 if ((ParentGroup.RootPart.ScriptEvents & ev) != 0)
2807 if (sendToRoot && ParentGroup.RootPart !=
this)
2809 CollidingMessage = CreateColliderArgs(ParentGroup.RootPart, colliders);
2810 if (CollidingMessage.
Colliders.Count > 0)
2811 notify(ParentGroup.RootPart.LocalId, CollidingMessage);
2816 private void SendLandCollisionEvent(
scriptEvents ev, ScriptCollidingNotification notify)
2818 bool sendToRoot =
true;
2821 List<DetectedObject> colliding =
new List<DetectedObject>();
2823 colliding.Add(CreateDetObjectForGround());
2824 LandCollidingMessage.Colliders = colliding;
2826 if (Inventory.ContainsScripts())
2828 if (!PassCollisions)
2831 if ((ScriptEvents & ev) != 0)
2832 notify(LocalId, LandCollidingMessage);
2834 if ((ParentGroup.RootPart.ScriptEvents & ev) != 0 && sendToRoot)
2836 notify(ParentGroup.RootPart.LocalId, LandCollidingMessage);
2842 if (ParentGroup.Scene == null || ParentGroup.IsDeleted)
2847 Dictionary<uint, ContactPoint> collissionswith = a.m_objCollisionList;
2848 List<uint> thisHitColliders =
new List<uint>();
2849 List<uint> endedColliders =
new List<uint>();
2850 List<uint> startedColliders =
new List<uint>();
2852 if (collissionswith.Count == 0)
2854 if (m_lastColliders.Count == 0)
2857 foreach (uint localID
in m_lastColliders)
2859 endedColliders.Add(localID);
2861 m_lastColliders.Clear();
2866 List<CollisionForSoundInfo> soundinfolist =
new List<CollisionForSoundInfo>();
2870 if (!VolumeDetectActive && CollisionSoundType >= 0)
2875 foreach (uint
id in collissionswith.Keys)
2877 thisHitColliders.Add(id);
2878 if (!m_lastColliders.Contains(
id))
2880 startedColliders.Add(id);
2882 curcontact = collissionswith[id];
2883 if (Math.Abs(curcontact.RelativeSpeed) > 0.2)
2886 soundinfo.colliderID = id;
2887 soundinfo.position = curcontact.Position;
2888 soundinfo.relativeVel = curcontact.RelativeSpeed;
2889 soundinfolist.Add(soundinfo);
2896 foreach (uint
id in collissionswith.Keys)
2898 thisHitColliders.Add(id);
2899 if (!m_lastColliders.Contains(
id))
2900 startedColliders.Add(
id);
2905 foreach (uint localID
in m_lastColliders)
2907 if (!thisHitColliders.Contains(localID))
2908 endedColliders.Add(localID);
2912 foreach (uint localID
in startedColliders)
2913 m_lastColliders.Add(localID);
2916 foreach (uint localID
in endedColliders)
2917 m_lastColliders.Remove(localID);
2920 if (soundinfolist.Count > 0)
2921 CollisionSounds.PartCollisionSound(
this, soundinfolist);
2924 SendCollisionEvent(
scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart);
2925 if (!VolumeDetectActive)
2926 SendCollisionEvent(
scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding);
2927 SendCollisionEvent(
scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd);
2929 if (startedColliders.Contains(0))
2930 SendLandCollisionEvent(
scriptEvents.land_collision_start, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingStart);
2931 if (m_lastColliders.Contains(0))
2932 SendLandCollisionEvent(
scriptEvents.land_collision, ParentGroup.Scene.EventManager.TriggerScriptLandColliding);
2933 if (endedColliders.Contains(0))
2934 SendLandCollisionEvent(
scriptEvents.land_collision_end, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd);
2940 if (soundID ==
UUID.Zero)
2944 if (soundModule == null)
2952 int now = Util.EnvironmentTickCount();
2953 if(Util.EnvironmentTickCountSubtract(now,LastColSoundSentTime) <200)
2956 LastColSoundSentTime = now;
2958 UUID ownerID = OwnerID;
2959 UUID objectID = ParentGroup.RootPart.UUID;
2960 UUID parentID = ParentGroup.UUID;
2961 ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle;
2963 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0 );
2971 "[SCENE OBJECT PART]: Physical object {0}, localID {1} went out of bounds at {2} in {3}. Stopping at {4} and making non-physical.",
2972 Name, LocalId, pos, ParentGroup.Scene.Name, AbsolutePosition);
2975 DoPhysicsPropertyUpdate(
false,
true);
2984 Vector3 newpos = pa.Position;
2985 if (!ParentGroup.Scene.PositionIsInCurrentRegion(newpos))
2988 ParentGroup.AbsolutePosition = newpos;
3014 ScheduleTerseUpdate();
3020 if ((Flags & flag) != 0)
3031 lock (m_scriptEvents)
3033 if (m_scriptEvents.ContainsKey(scriptid))
3039 AggregateScriptEvents &= ~oldparts;
3040 m_scriptEvents.Remove(scriptid);
3041 aggregateScriptEvents();
3053 UUID = UUID.Random();
3056 Inventory.ResetInventoryIDs();
3071 if (ParentGroup.Scene != null)
3073 float minsize = ParentGroup.Scene.m_minNonphys;
3074 float maxsize = ParentGroup.Scene.m_maxNonphys;
3077 minsize = ParentGroup.Scene.m_minPhys;
3078 maxsize = ParentGroup.Scene.m_maxPhys;
3080 scale.X = Util.Clamp(scale.X, minsize, maxsize);
3081 scale.Y = Util.Clamp(scale.Y, minsize, maxsize);
3082 scale.Z = Util.Clamp(scale.Z, minsize, maxsize);
3088 ParentGroup.HasGroupChanged =
true;
3089 ScheduleFullUpdate();
3092 public void RotLookAt(Quaternion target,
float strength,
float damping)
3094 if(ParentGroup.IsDeleted)
3098 if(!ParentGroup.UsesPhysics || ParentGroup.IsAttachment)
3102 if(ParentGroup.RootPart !=
this)
3104 ParentGroup.RotLookAt(target, strength, damping);
3109 APIDStrength = strength;
3110 APIDTarget = target;
3112 if (APIDStrength <= 0)
3114 m_log.WarnFormat(
"[SceneObjectPart] Invalid rotation strength {0}",APIDStrength);
3121 ParentGroup.QueueForUpdateCheck();
3124 public void StartLookAt(Quaternion target,
float strength,
float damping)
3126 if(ParentGroup.IsDeleted)
3130 if(ParentGroup.IsAttachment || !ParentGroup.UsesPhysics)
3134 if(ParentGroup.RootPart !=
this)
3135 ParentGroup.RotLookAt(target, strength, damping);
3137 RotLookAt(target,strength,damping);
3142 if(ParentGroup.IsDeleted)
3145 if(ParentGroup.RootPart !=
this && ParentGroup.UsesPhysics)
3146 ParentGroup.StopLookAt();
3157 if (ParentGroup == null)
3163 ScheduleFullUpdate();
3173 if (ParentGroup == null)
3176 ParentGroup.QueueForUpdateCheck();
3178 int timeNow = Util.UnixTimeSinceEpoch();
3183 if (timeNow <= TimeStampFull)
3189 TimeStampFull = (uint)timeNow;
3192 UpdateFlag = UpdateRequired.FULL;
3198 if (ParentGroup.Scene != null)
3199 ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(
this,
true);
3208 if (ParentGroup == null)
3214 if (ParentGroup.IsAttachment)
3216 ScheduleFullUpdate();
3222 ParentGroup.HasGroupChanged =
true;
3223 ParentGroup.QueueForUpdateCheck();
3225 TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
3226 UpdateFlag = UpdateRequired.TERSE;
3233 if (ParentGroup.Scene != null)
3234 ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(
this,
false);
3239 ParentGroup.ScriptSetPhysicsStatus(UsePhysics);
3279 protected internal void SendFullUpdate(
IClientAPI remoteClient)
3281 if (ParentGroup == null)
3288 if (ParentGroup.IsAttachment)
3290 ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
3293 sp.SendAttachmentUpdate(
this, UpdateRequired.FULL);
3313 SendFullUpdateToClient(remoteClient);
3322 if (ParentGroup == null)
3326 m_lastPosition = OffsetPosition;
3327 m_lastRotation = RotationOffset;
3331 m_lastUpdateSentTime = Environment.TickCount;
3333 ParentGroup.Scene.ForEachScenePresence(delegate(
ScenePresence avatar)
3341 if (ParentGroup == null)
3345 m_lastPosition = OffsetPosition;
3346 m_lastRotation = RotationOffset;
3350 m_lastUpdateSentTime = Environment.TickCount;
3352 if (ParentGroup.IsAttachment)
3354 ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
3357 sp.SendAttachmentUpdate(
this, UpdateRequired.FULL);
3362 ParentGroup.Scene.ForEachScenePresence(delegate(
ScenePresence avatar)
3375 SendFullUpdateToClient(remoteClient, OffsetPosition);
3385 if (ParentGroup == null)
3393 if (ParentGroup.IsDeleted)
3396 if (ParentGroup.IsAttachment
3397 && ParentGroup.AttachedAvatar != remoteClient.
AgentId
3398 && ParentGroup.HasPrivateAttachmentPoint)
3401 if (remoteClient.
AgentId == OwnerID)
3403 if ((Flags &
PrimFlags.CreateSelected) != 0)
3410 remoteClient.SendEntityUpdate(
this, PrimUpdateFlags.FullUpdate);
3411 ParentGroup.Scene.StatsReporter.AddObjectUpdates(1);
3419 const float ROTATION_TOLERANCE = 0.01f;
3420 const float VELOCITY_TOLERANCE = 0.001f;
3421 const float POSITION_TOLERANCE = 0.05f;
3422 const int TIME_MS_TOLERANCE = 200;
3426 case UpdateRequired.TERSE:
3428 ClearUpdateSchedule();
3430 if (!RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) ||
3431 !Acceleration.Equals(m_lastAcceleration) ||
3432 !
Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) ||
3433 Velocity.ApproxEquals(Vector3.Zero, VELOCITY_TOLERANCE) ||
3434 !
AngularVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) ||
3435 !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) ||
3436 Environment.TickCount - m_lastUpdateSentTime > TIME_MS_TOLERANCE)
3438 SendTerseUpdateToAllClientsInternal();
3442 case UpdateRequired.FULL:
3444 ClearUpdateSchedule();
3445 SendFullUpdateToAllClientsInternal();
3457 if (ParentGroup == null || ParentGroup.Scene == null)
3461 m_lastPosition = OffsetPosition;
3462 m_lastRotation = RotationOffset;
3466 m_lastUpdateSentTime = Environment.TickCount;
3468 ParentGroup.Scene.ForEachClient(delegate(
IClientAPI client)
3470 SendTerseUpdateToClient(client);
3476 if (ParentGroup == null || ParentGroup.Scene == null)
3480 m_lastPosition = OffsetPosition;
3481 m_lastRotation = RotationOffset;
3485 m_lastUpdateSentTime = Environment.TickCount;
3487 if (ParentGroup.IsAttachment)
3489 ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
3492 sp.SendAttachmentUpdate(
this, UpdateRequired.TERSE);
3497 ParentGroup.Scene.ForEachClient(delegate(
IClientAPI client)
3499 SendTerseUpdateToClient(client);
3506 ParentGroup.SetAxisRotation(axis, rotate);
3510 STATUS_ROTATE_X = rotate;
3513 STATUS_ROTATE_Y = rotate;
3516 STATUS_ROTATE_Z = rotate;
3532 if (ParentGroup.IsDeleted)
3535 ParentGroup.RootPart.DIE_AT_EDGE = p;
3543 pa.FloatOnWater = (floatYN == 1);
3555 return m_vehicleParams;
3559 m_vehicleParams = value;
3563 public int VehicleType
3567 if (m_vehicleParams == null)
3568 return (
int)Vehicle.TYPE_NONE;
3570 return (
int)m_vehicleParams.Type;
3574 SetVehicleType(value);
3580 m_vehicleParams = null;
3582 if (type == (
int)
Vehicle.TYPE_NONE)
3584 if (_parentID ==0 && PhysActor != null)
3585 PhysActor.VehicleType = (int)
Vehicle.TYPE_NONE;
3589 m_vehicleParams.ProcessTypeChange((
Vehicle)type);
3591 if (_parentID ==0 && PhysActor != null)
3592 PhysActor.VehicleType = type;
3599 if (m_vehicleParams == null)
3602 m_vehicleParams.ProcessVehicleFlags(param,
remove);
3604 if (_parentID ==0 && PhysActor != null)
3606 PhysActor.VehicleFlags(param,
remove);
3612 if (m_vehicleParams == null)
3615 m_vehicleParams.ProcessFloatVehicleParam((
Vehicle)param, value);
3617 if (_parentID == 0 && PhysActor != null)
3619 PhysActor.VehicleFloatParam(param, value);
3625 if (m_vehicleParams == null)
3628 m_vehicleParams.ProcessVectorVehicleParam((
Vehicle)param, value);
3630 if (_parentID == 0 && PhysActor != null)
3632 PhysActor.VehicleVectorParam(param, value);
3638 if (m_vehicleParams == null)
3641 m_vehicleParams.ProcessRotationVehicleParam((
Vehicle)param, rotation);
3643 if (_parentID == 0 && PhysActor != null)
3645 PhysActor.VehicleRotationParam(param,
rotation);
3657 Vector3 clippedColor = Util.Clip(color, 0.0f, 1.0f);
3658 float clippedAlpha = alpha.HasValue ?
3659 Util.Clip((float)alpha.Value, 0.0f, 1.0f) : 0;
3663 Byte[] buf = Shape.Textures.GetBytes();
3664 Primitive.TextureEntry tex =
new Primitive.TextureEntry(buf, 0, buf.Length);
3666 if (face >= 0 && face < GetNumberOfSides())
3668 texcolor = tex.CreateFace((uint)face).RGBA;
3669 texcolor.R = clippedColor.X;
3670 texcolor.G = clippedColor.Y;
3671 texcolor.B = clippedColor.Z;
3674 texcolor.A = clippedAlpha;
3676 tex.FaceTextures[face].RGBA = texcolor;
3677 UpdateTextureEntry(tex.GetBytes());
3680 else if (face == ALL_SIDES)
3682 for (uint i = 0; i < GetNumberOfSides(); i++)
3684 if (tex.FaceTextures[i] != null)
3686 texcolor = tex.FaceTextures[i].RGBA;
3687 texcolor.R = clippedColor.X;
3688 texcolor.G = clippedColor.Y;
3689 texcolor.B = clippedColor.Z;
3692 texcolor.A = clippedAlpha;
3694 tex.FaceTextures[i].RGBA = texcolor;
3696 texcolor = tex.DefaultTexture.RGBA;
3697 texcolor.R = clippedColor.X;
3698 texcolor.G = clippedColor.Y;
3699 texcolor.B = clippedColor.Z;
3702 texcolor.A = clippedAlpha;
3704 tex.DefaultTexture.RGBA = texcolor;
3706 UpdateTextureEntry(tex.GetBytes());
3724 HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut);
3730 if (hasCut) ret += 2;
3731 if (hasHollow) ret += 1;
3733 case PrimType.CYLINDER:
3735 if (hasCut) ret += 2;
3736 if (hasHollow) ret += 1;
3738 case PrimType.PRISM:
3740 if (hasCut) ret += 2;
3741 if (hasHollow) ret += 1;
3743 case PrimType.SPHERE:
3745 if (hasCut) ret += 2;
3746 if (hasDimple) ret += 2;
3747 if (hasHollow) ret += 1;
3749 case PrimType.TORUS:
3751 if (hasCut) ret += 2;
3752 if (hasProfileCut) ret += 2;
3753 if (hasHollow) ret += 1;
3757 if (hasCut) ret += 2;
3758 if (hasProfileCut) ret += 2;
3759 if (hasHollow) ret += 1;
3763 if (hasCut) ret += 2;
3764 if (hasProfileCut) ret += 2;
3765 if (hasHollow) ret += 1;
3767 case PrimType.SCULPT:
3769 if (Shape.SculptType == (byte)
SculptType.Mesh)
3786 if (Shape.SculptEntry)
3787 return PrimType.SCULPT;
3789 if ((Shape.ProfileCurve & 0x07) == (byte)
ProfileShape.Square)
3791 if (Shape.PathCurve == (byte)
Extrusion.Straight)
3792 return PrimType.BOX;
3793 else if (Shape.PathCurve == (byte)
Extrusion.Curve1)
3794 return PrimType.TUBE;
3796 else if ((Shape.ProfileCurve & 0x07) == (byte)
ProfileShape.Circle)
3798 if (Shape.PathCurve == (byte)
Extrusion.Straight)
3799 return PrimType.CYLINDER;
3801 else if (Shape.PathCurve == (byte)
Extrusion.Curve1)
3802 return PrimType.TORUS;
3804 else if ((Shape.ProfileCurve & 0x07) == (byte)
ProfileShape.HalfCircle)
3806 if (Shape.PathCurve == (byte)
Extrusion.Curve1 || Shape.PathCurve == (byte)
Extrusion.Curve2)
3807 return PrimType.SPHERE;
3809 else if ((Shape.ProfileCurve & 0x07) == (byte)
ProfileShape.EquilateralTriangle)
3811 if (Shape.PathCurve == (byte)
Extrusion.Straight)
3812 return PrimType.PRISM;
3813 else if (Shape.PathCurve == (byte)
Extrusion.Curve1)
3814 return PrimType.RING;
3817 return PrimType.BOX;
3830 out
bool hasDimple, out
bool hasProfileCut)
3838 hasCut = (shape.ProfileBegin > 0) || (shape.
ProfileEnd > 0);
3840 hasCut = (shape.PathBegin > 0) || (shape.
PathEnd > 0);
3842 hasHollow = shape.ProfileHollow > 0;
3843 hasDimple = (shape.ProfileBegin > 0) || (shape.
ProfileEnd > 0);
3844 hasProfileCut = hasDimple;
3857 UpdateFlag = UpdateRequired.FULL;
3865 ParentGroup = parent;
3880 pa.LockAngularMotion(RotationAxisLocks);
3881 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
3897 lock (m_scriptEvents)
3899 if (m_scriptEvents.ContainsKey(scriptid))
3913 aggregateScriptEvents();
3924 if (ParentGroup != null)
3926 ParentGroup.HasGroupChanged =
true;
3927 ScheduleFullUpdate();
3937 public void SetText(
string text, Vector3 color,
double alpha)
3939 Color = Color.FromArgb((int) (alpha*0xff),
3940 (int) (color.X*0xff),
3941 (int) (color.Y*0xff),
3942 (int) (color.Z*0xff));
3948 ParentGroup.StopMoveToTarget();
3953 if (m_UndoRedo == null)
3958 if (!Undoing && !IgnoreUndoUpdate && ParentGroup != null)
3960 m_UndoRedo.StoreUndo(
this, change);
3968 public int UndoCount
3972 if (m_UndoRedo == null)
3974 return m_UndoRedo.Count;
3980 if (m_UndoRedo == null || Undoing || ParentGroup == null)
3986 m_UndoRedo.Undo(
this);
3993 if (m_UndoRedo == null || Undoing || ParentGroup == null)
3999 m_UndoRedo.Redo(
this);
4006 if (m_UndoRedo == null || Undoing)
4021 Vector3 vAbsolutePosition = AbsolutePosition;
4022 Vector3 vScale =
Scale;
4023 Vector3 rOrigin = iray.Origin;
4024 Vector3 rDirection = iray.Direction;
4028 Vector3 r2ndDirection = rDirection*rDirection;
4029 float itestPart1 = r2ndDirection.X + r2ndDirection.Y + r2ndDirection.Z;
4032 Vector3 tmVal2 = rOrigin - vAbsolutePosition;
4033 Vector3 r2Direction = rDirection*2.0f;
4034 Vector3 tmVal3 = r2Direction*tmVal2;
4036 float itestPart2 = tmVal3.X + tmVal3.Y + tmVal3.Z;
4039 Vector3 tmVal4 = rOrigin*rOrigin;
4040 Vector3 tmVal5 = vAbsolutePosition*vAbsolutePosition;
4042 Vector3 tmVal6 = vAbsolutePosition*rOrigin;
4046 if (vScale.X > radius)
4048 if (vScale.Y > radius)
4050 if (vScale.Z > radius)
4058 radius = (radius / 2) + (0.5f / 2) - 0.1f;
4062 float itestPart3 = tmVal4.X + tmVal4.Y + tmVal4.Z + tmVal5.X + tmVal5.Y + tmVal5.Z -
4063 (2.0f*(tmVal6.X + tmVal6.Y + tmVal6.Z + (radius*radius)));
4066 float rootsqr = (itestPart2*itestPart2) - (4.0f*itestPart1*itestPart3);
4072 float root = ((-itestPart2) - (
float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f);
4077 root = ((-itestPart2) + (
float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f);
4090 new Vector3(iray.Origin.X + (iray.Direction.X*root), iray.Origin.Y + (iray.Direction.Y*root),
4091 iray.Origin.Z + (iray.Direction.Z*root));
4093 result.HitTF =
true;
4094 result.ipoint = ipoint;
4097 Vector3 normalpart = ipoint - vAbsolutePosition;
4098 result.normal = normalpart / normalpart.Length();
4103 Vector3 distanceConvert1 =
new Vector3(iray.Origin.X, iray.Origin.Y, iray.Origin.Z);
4104 Vector3 distanceConvert2 =
new Vector3(ipoint.X, ipoint.Y, ipoint.Z);
4105 float distance = (float) Util.GetDistanceTo(distanceConvert1, distanceConvert2);
4107 result.distance = distance;
4117 Vector3[] vertexes =
new Vector3[8];
4120 Vector3[] FaceA =
new Vector3[6];
4121 Vector3[] FaceB =
new Vector3[6];
4122 Vector3[] FaceC =
new Vector3[6];
4123 Vector3[] FaceD =
new Vector3[6];
4125 Vector3[] normals =
new Vector3[6];
4126 Vector3[] AAfacenormals =
new Vector3[6];
4128 AAfacenormals[0] =
new Vector3(1, 0, 0);
4129 AAfacenormals[1] =
new Vector3(0, 1, 0);
4130 AAfacenormals[2] =
new Vector3(-1, 0, 0);
4131 AAfacenormals[3] =
new Vector3(0, -1, 0);
4132 AAfacenormals[4] =
new Vector3(0, 0, 1);
4133 AAfacenormals[5] =
new Vector3(0, 0, -1);
4135 Vector3 AmBa =
new Vector3(0, 0, 0);
4136 Vector3 AmBb =
new Vector3(0, 0, 0);
4137 Vector3 cross =
new Vector3();
4139 Vector3 pos = GetWorldPosition();
4140 Quaternion rot = GetWorldRotation();
4144 Quaternion AXrot = rot;
4147 Vector3 AXpos = pos;
4153 Vector3 tScale = Vector3.Zero;
4155 Vector3 AXscale =
new Vector3(m_shape.Scale.X * 0.5f, m_shape.Scale.Y * 0.5f, m_shape.Scale.Z * 0.5f);
4161 Vector3 rScale =
new Vector3();
4165 #region ABCD Face Vertex Map Comment Diagram
4197 #region Plane Decomposition of Oriented Bounding Box
4198 tScale =
new Vector3(AXscale.X, -AXscale.Y, AXscale.Z);
4199 rScale = tScale * AXrot;
4200 vertexes[0] = (
new Vector3((pos.X + rScale.X), (pos.Y + rScale.Y), (pos.Z + rScale.Z)));
4205 FaceA[0] = vertexes[0];
4206 FaceB[3] = vertexes[0];
4207 FaceA[4] = vertexes[0];
4210 rScale = tScale * AXrot;
4211 vertexes[1] = (
new Vector3((pos.X + rScale.X), (pos.Y + rScale.Y), (pos.Z + rScale.Z)));
4217 FaceB[0] = vertexes[1];
4218 FaceA[1] = vertexes[1];
4219 FaceC[4] = vertexes[1];
4221 tScale =
new Vector3(AXscale.X, -AXscale.Y, -AXscale.Z);
4222 rScale = tScale * AXrot;
4224 vertexes[2] = (
new Vector3((pos.X + rScale.X), (pos.Y + rScale.Y), (pos.Z + rScale.Z)));
4230 FaceC[0] = vertexes[2];
4231 FaceD[3] = vertexes[2];
4232 FaceC[5] = vertexes[2];
4234 tScale =
new Vector3(AXscale.X, AXscale.Y, -AXscale.Z);
4235 rScale = tScale * AXrot;
4236 vertexes[3] = (
new Vector3((pos.X + rScale.X), (pos.Y + rScale.Y), (pos.Z + rScale.Z)));
4242 FaceD[0] = vertexes[3];
4243 FaceC[1] = vertexes[3];
4244 FaceA[5] = vertexes[3];
4246 tScale =
new Vector3(-AXscale.X, AXscale.Y, AXscale.Z);
4247 rScale = tScale * AXrot;
4248 vertexes[4] = (
new Vector3((pos.X + rScale.X), (pos.Y + rScale.Y), (pos.Z + rScale.Z)));
4254 FaceB[1] = vertexes[4];
4255 FaceA[2] = vertexes[4];
4256 FaceD[4] = vertexes[4];
4258 tScale =
new Vector3(-AXscale.X, AXscale.Y, -AXscale.Z);
4259 rScale = tScale * AXrot;
4260 vertexes[5] = (
new Vector3((pos.X + rScale.X), (pos.Y + rScale.Y), (pos.Z + rScale.Z)));
4266 FaceD[1] = vertexes[5];
4267 FaceC[2] = vertexes[5];
4268 FaceB[5] = vertexes[5];
4270 tScale =
new Vector3(-AXscale.X, -AXscale.Y, AXscale.Z);
4271 rScale = tScale * AXrot;
4272 vertexes[6] = (
new Vector3((pos.X + rScale.X), (pos.Y + rScale.Y), (pos.Z + rScale.Z)));
4278 FaceB[2] = vertexes[6];
4279 FaceA[3] = vertexes[6];
4280 FaceB[4] = vertexes[6];
4282 tScale =
new Vector3(-AXscale.X, -AXscale.Y, -AXscale.Z);
4283 rScale = tScale * AXrot;
4284 vertexes[7] = (
new Vector3((pos.X + rScale.X), (pos.Y + rScale.Y), (pos.Z + rScale.Z)));
4290 FaceD[2] = vertexes[7];
4291 FaceC[3] = vertexes[7];
4292 FaceD[5] = vertexes[7];
4296 for (
int i = 0; i < 6; i++)
4301 AmBa = FaceA[i] - FaceB[i];
4302 AmBb = FaceB[i] - FaceC[i];
4304 cross = Vector3.Cross(AmBb, AmBa);
4307 normals[i] = cross / cross.Length();
4315 result.distance = 1024;
4319 Vector3 q =
new Vector3();
4321 #region OBB Version 2 Experiment
4376 for (
int i = 0; i < 6; i++)
4378 AmBa = FaceA[i] - FaceB[i];
4379 AmBb = FaceB[i] - FaceC[i];
4380 d = Vector3.Dot(normals[i], FaceB[i]);
4388 c = Vector3.Dot(iray.Direction, normals[i]);
4393 a = (d - Vector3.Dot(iray.Origin, normals[i])) / c;
4399 if (Vector3.Dot(iray.Direction, normals[i]) < 0 || !frontFacesOnly)
4407 q = iray.Origin + iray.Direction * a;
4410 float distance2 = (float)GetDistanceTo(q, AXpos);
4419 result.distance = distance2;
4420 result.HitTF =
true;
4428 result.normal = AAfacenormals[i] * AXrot;
4430 Vector3 scaleComponent = AAfacenormals[i];
4431 float ScaleOffset = 0.5f;
4432 if (scaleComponent.X != 0) ScaleOffset = AXscale.X;
4433 if (scaleComponent.Y != 0) ScaleOffset = AXscale.Y;
4434 if (scaleComponent.Z != 0) ScaleOffset = AXscale.Z;
4435 ScaleOffset = Math.Abs(ScaleOffset);
4436 Vector3 offset = result.normal * ScaleOffset;
4437 result.ipoint = AXpos + offset;
4443 result.normal = normals[i];
4445 result.AAfaceNormal = AAfacenormals[i];
4456 public void ToXml(XmlTextWriter xmlWriter)
4458 SceneObjectSerializer.SOPToXml2(xmlWriter,
this,
new Dictionary<string, object>());
4463 if (ParentGroup != null && ParentGroup.Scene != null)
4464 ParentGroup.Scene.EventManager.TriggerOnScriptChangedEvent(LocalId, (uint)val);
4472 EveryoneMask &= (uint)(PermissionMask.All | PermissionMask.Export);
4478 m_shape.ReadInUpdateExtraParam(type, inUse, data);
4488 if (ParentGroup != null)
4490 ParentGroup.HasGroupChanged =
true;
4491 ScheduleFullUpdate();
4497 Vector3 oldPos = GroupPosition;
4499 if ((newPos.X != oldPos.X) ||
4500 (newPos.Y != oldPos.Y) ||
4501 (newPos.Z != oldPos.Z))
4503 GroupPosition = newPos;
4504 ScheduleTerseUpdate();
4514 Vector3 oldPos = OffsetPosition;
4516 if ((newPos.X != oldPos.X) ||
4517 (newPos.Y != oldPos.Y) ||
4518 (newPos.Z != oldPos.Z))
4520 if (ParentGroup.RootPart.GetStatusSandbox())
4522 if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10)
4524 ParentGroup.RootPart.ScriptSetPhysicsStatus(
false);
4525 newPos = OffsetPosition;
4526 ParentGroup.Scene.SimChat(Utils.StringToBytes(
"Hit Sandbox Limit"),
4527 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, ParentGroup.RootPart.AbsolutePosition, Name,
UUID,
false);
4531 OffsetPosition = newPos;
4532 ScheduleTerseUpdate();
4547 bool set = addRemTF == 1;
4548 bool god = ParentGroup.Scene.Permissions.IsGod(AgentID);
4550 uint baseMask = BaseMask;
4552 baseMask = 0x7ffffff0;
4555 if ((AgentID == OwnerID) || god)
4562 BaseMask = ApplyMask(BaseMask, set, mask);
4563 Inventory.ApplyGodPermissions(BaseMask);
4568 OwnerMask = ApplyMask(OwnerMask, set, mask) &
4572 GroupMask = ApplyMask(GroupMask, set, mask) &
4582 EveryoneMask = ApplyMask(EveryoneMask, set, mask) &
4592 NextOwnerMask = ApplyMask(NextOwnerMask, set, mask) &
4599 NextOwnerMask |= (uint)PermissionMask.Move;
4604 SendFullUpdateToAllClients();
4610 uint prevOwnerMask = OwnerMask;
4611 uint prevGroupMask = GroupMask;
4612 uint prevEveryoneMask = EveryoneMask;
4613 uint prevNextOwnerMask = NextOwnerMask;
4615 OwnerMask = source.OwnerMask & BaseMask;
4616 GroupMask = source.GroupMask & BaseMask;
4617 EveryoneMask = source.EveryoneMask & BaseMask;
4618 NextOwnerMask = source.NextOwnerMask & BaseMask;
4620 if (OwnerMask != prevOwnerMask ||
4621 GroupMask != prevGroupMask ||
4622 EveryoneMask != prevEveryoneMask ||
4623 NextOwnerMask != prevNextOwnerMask)
4624 SendFullUpdateToAllClients();
4632 if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
4634 string hingeString =
"hingejoint";
4635 return (Name.Length >= hingeString.Length && Name.Substring(0, hingeString.Length) == hingeString);
4648 if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
4650 string ballString =
"balljoint";
4651 return (Name.Length >= ballString.Length && Name.Substring(0, ballString.Length) == ballString);
4664 if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
4666 return IsHingeJoint() || IsBallJoint();
4686 if(Density != physdata.
Density)
4687 Density = physdata.Density;
4689 GravityModifier = physdata.GravitationModifier;
4691 Friction = physdata.Friction;
4692 if(Restitution != physdata.
Bounce)
4693 Restitution = physdata.Bounce;
4702 public void UpdatePrimFlags(
bool UsePhysics,
bool SetTemporary,
bool SetPhantom,
bool SetVD,
bool building)
4704 bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0);
4705 bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0);
4706 bool wasPhantom = ((Flags & PrimFlags.Phantom) != 0);
4707 bool wasVD = VolumeDetectActive;
4709 if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD))
4712 VolumeDetectActive = SetVD;
4715 if (VolumeDetectActive)
4734 if (ParentGroup.Scene == null)
4739 if (pa != null && building && pa.
Building != building)
4740 pa.Building = building;
4742 if ((SetPhantom && !UsePhysics && !SetVD) || ParentGroup.IsAttachment || PhysicsShapeType == (byte)
PhysShapeType.none
4743 || (Shape.PathCurve == (byte)
Extrusion.Flexible))
4748 ParentGroup.Scene.RemovePhysicalPrim(1);
4749 RemoveFromPhysics();
4757 if (ParentGroup.Scene.CollidablePrims)
4761 AddToPhysics(UsePhysics, SetPhantom, building,
false);
4786 DoPhysicsPropertyUpdate(UsePhysics,
true);
4792 DoPhysicsPropertyUpdate(UsePhysics,
false);
4801 pa.Building = building;
4804 UpdatePhysicsSubscribedEvents();
4816 pa.SetVolumeDetect(1);
4818 VolumeDetectActive =
true;
4822 else if (SetVD != wasVD)
4827 pa.SetVolumeDetect(0);
4830 VolumeDetectActive =
false;
4834 if (ParentGroup != null)
4836 ParentGroup.HasGroupChanged =
true;
4837 ScheduleFullUpdate();
4851 private void AddToPhysics(
bool isPhysical,
bool isPhantom,
bool building,
bool applyDynamics)
4860 pa = ParentGroup.Scene.PhysicsScene.AddPrimShape(
4861 string.Format(
"{0}/{1}", Name,
UUID),
4873 m_log.ErrorFormat(
"[SCENE]: caught exception meshing object {0}. Object set to phantom. e={1}", m_uuid, e);
4879 pa.SOPName = this.Name;
4882 pa.Density = Density;
4883 pa.GravModifier = GravityModifier;
4884 pa.Friction = Friction;
4885 pa.Restitution = Restitution;
4887 if(LocalId == ParentGroup.RootPart.LocalId)
4889 pa.LockAngularMotion(RotationAxisLocks);
4892 if (VolumeDetectActive)
4893 pa.SetVolumeDetect(1);
4895 if (m_vehicleParams != null && LocalId == ParentGroup.RootPart.LocalId)
4896 m_vehicleParams.SetVehicle(pa);
4906 if (ParentGroup.RootPart.KeyframeMotion != null)
4907 ParentGroup.RootPart.KeyframeMotion.Stop();
4908 ParentGroup.RootPart.KeyframeMotion = null;
4909 ParentGroup.Scene.AddPhysicalPrim(1);
4911 pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
4912 pa.OnOutOfBounds += PhysicsOutOfBounds;
4914 if (ParentID != 0 && ParentID != LocalId)
4916 PhysicsActor parentPa = ParentGroup.RootPart.PhysActor;
4918 if (parentPa != null)
4925 if (applyDynamics && LocalId == ParentGroup.RootPart.LocalId)
4930 pa.RotationalVelocity = rotationalVelocity;
4933 if ((m_vehicleParams == null || m_vehicleParams.Type ==
Vehicle.TYPE_NONE))
4943 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
4946 pa.Building =
false;
4951 ParentGroup.Scene.EventManager.TriggerObjectAddedToPhysicalScene(
this);
4966 pa.OnCollisionUpdate -= PhysicsCollision;
4967 pa.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
4968 pa.OnOutOfBounds -= PhysicsOutOfBounds;
4970 ParentGroup.Scene.PhysicsScene.RemovePrim(pa);
4972 ParentGroup.Scene.EventManager.TriggerObjectRemovedFromPhysicalScene(
this);
4983 if (rot != RotationOffset)
4985 RotationOffset = rot;
4987 if (ParentGroup != null)
4989 ParentGroup.HasGroupChanged =
true;
4990 ScheduleTerseUpdate();
5001 m_shape.PathBegin = shapeBlock.PathBegin;
5002 m_shape.PathEnd = shapeBlock.PathEnd;
5003 m_shape.PathScaleX = shapeBlock.PathScaleX;
5004 m_shape.PathScaleY = shapeBlock.PathScaleY;
5005 m_shape.PathShearX = shapeBlock.PathShearX;
5006 m_shape.PathShearY = shapeBlock.PathShearY;
5007 m_shape.PathSkew = shapeBlock.PathSkew;
5008 m_shape.ProfileBegin = shapeBlock.ProfileBegin;
5009 m_shape.ProfileEnd = shapeBlock.ProfileEnd;
5010 m_shape.PathCurve = shapeBlock.PathCurve;
5011 m_shape.ProfileCurve = shapeBlock.ProfileCurve;
5012 m_shape.ProfileHollow = shapeBlock.ProfileHollow;
5013 m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset;
5014 m_shape.PathRevolutions = shapeBlock.PathRevolutions;
5015 m_shape.PathTaperX = shapeBlock.PathTaperX;
5016 m_shape.PathTaperY = shapeBlock.PathTaperY;
5017 m_shape.PathTwist = shapeBlock.PathTwist;
5018 m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;
5025 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
5034 if (ParentGroup.RootPart !=
this)
5035 ParentGroup.RootPart.Rezzed = DateTime.UtcNow;
5037 ParentGroup.HasGroupChanged =
true;
5038 TriggerScriptChangedEvent(
Changed.SHAPE);
5039 ScheduleFullUpdate();
5050 end = Math.Min(1f, Math.Max(0f, end));
5051 begin = Math.Min(Math.Min(1f, Math.Max(0f, begin)), end - 0.02f);
5052 if (begin < 0.02f && end < 0.02f)
5058 ushort uBegin = (ushort)(50000.0 * begin);
5059 ushort uEnd = (ushort)(50000.0 * (1f - end));
5060 bool updatePossiblyNeeded =
false;
5064 if (m_shape.ProfileBegin != uBegin || m_shape.ProfileEnd != uEnd)
5066 m_shape.ProfileBegin = uBegin;
5067 m_shape.ProfileEnd = uEnd;
5068 updatePossiblyNeeded =
true;
5071 else if (m_shape.PathBegin != uBegin || m_shape.PathEnd != uEnd)
5073 m_shape.PathBegin = uBegin;
5074 m_shape.PathEnd = uEnd;
5075 updatePossiblyNeeded =
true;
5078 if (updatePossiblyNeeded && ParentGroup != null)
5080 ParentGroup.HasGroupChanged =
true;
5082 if (updatePossiblyNeeded && PhysActor != null)
5084 PhysActor.Shape = m_shape;
5085 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
5087 if (updatePossiblyNeeded)
5089 ScheduleFullUpdate();
5135 UpdateTextureEntry(
new Primitive.TextureEntry(serializedTextureEntry, 0, serializedTextureEntry.Length));
5144 Primitive.TextureEntry oldTex = Shape.Textures;
5148 Primitive.TextureEntryFace fallbackNewFace = newTex.DefaultTexture;
5149 Primitive.TextureEntryFace fallbackOldFace = oldTex.DefaultTexture;
5153 if (fallbackNewFace == null)
5155 fallbackNewFace =
new Primitive.TextureEntry(Util.BLANK_TEXTURE_UUID).CreateFace(0);
5156 newTex.DefaultTexture = fallbackNewFace;
5158 if (fallbackOldFace == null)
5160 fallbackOldFace =
new Primitive.TextureEntry(Util.BLANK_TEXTURE_UUID).CreateFace(0);
5161 oldTex.DefaultTexture = fallbackOldFace;
5170 bool otherFieldsChanged =
false;
5172 for (
int i = 0 ; i < GetNumberOfSides(); i++)
5175 Primitive.TextureEntryFace newFace = newTex.DefaultTexture;
5176 Primitive.TextureEntryFace oldFace = oldTex.DefaultTexture;
5178 if (oldTex.FaceTextures[i] != null)
5179 oldFace = oldTex.FaceTextures[i];
5180 if (newTex.FaceTextures[i] != null)
5181 newFace = newTex.FaceTextures[i];
5183 Color4 oldRGBA = oldFace.RGBA;
5184 Color4 newRGBA = newFace.RGBA;
5186 if (oldRGBA.R != newRGBA.R ||
5187 oldRGBA.G != newRGBA.G ||
5188 oldRGBA.B != newRGBA.B ||
5189 oldRGBA.A != newRGBA.A)
5190 changeFlags |= Changed.COLOR;
5192 if (oldFace.TextureID != newFace.TextureID)
5193 changeFlags |= Changed.TEXTURE;
5199 if (!otherFieldsChanged)
5201 if (oldFace.Bump != newFace.Bump) otherFieldsChanged =
true;
5202 if (oldFace.Fullbright != newFace.Fullbright) otherFieldsChanged =
true;
5203 if (oldFace.Glow != newFace.Glow) otherFieldsChanged =
true;
5204 if (oldFace.MediaFlags != newFace.MediaFlags) otherFieldsChanged =
true;
5205 if (oldFace.OffsetU != newFace.OffsetU) otherFieldsChanged =
true;
5206 if (oldFace.OffsetV != newFace.OffsetV) otherFieldsChanged =
true;
5207 if (oldFace.RepeatU != newFace.RepeatU) otherFieldsChanged =
true;
5208 if (oldFace.RepeatV != newFace.RepeatV) otherFieldsChanged =
true;
5209 if (oldFace.Rotation != newFace.Rotation) otherFieldsChanged =
true;
5210 if (oldFace.Shiny != newFace.Shiny) otherFieldsChanged =
true;
5211 if (oldFace.TexMapType != newFace.TexMapType) otherFieldsChanged =
true;
5215 if (changeFlags != 0 || otherFieldsChanged)
5217 m_shape.TextureEntry = newTex.GetBytes();
5218 if (changeFlags != 0)
5219 TriggerScriptChangedEvent(changeFlags);
5220 UpdateFlag = UpdateRequired.FULL;
5221 ParentGroup.HasGroupChanged =
true;
5226 ScheduleFullUpdate();
5231 private void UpdatePhysicsSubscribedEvents()
5237 pa.OnCollisionUpdate -= PhysicsCollision;
5239 bool hassound = (!VolumeDetectActive && CollisionSoundType >= 0 && ((Flags & PrimFlags.Physics) != 0));
5244 if (ParentGroup != null && ParentGroup.RootPart != null)
5245 CombinedEvents |= ParentGroup.RootPart.AggregateScriptEvents;
5248 if (VolumeDetectActive)
5249 CombinedEvents &= PhyscicsVolumeDtcSubsEvents;
5250 else if ((Flags &
PrimFlags.Phantom) != 0)
5251 CombinedEvents &= PhyscicsPhantonSubsEvents;
5253 CombinedEvents &= PhysicsNeededSubsEvents;
5255 if (hassound || CombinedEvents != 0)
5258 pa.OnCollisionUpdate += PhysicsCollision;
5259 pa.SubscribeEvents(50);
5263 pa.UnSubscribeEvents();
5270 if (ParentGroup == null || ParentGroup.RootPart == null)
5273 AggregateScriptEvents = 0;
5276 lock (m_scriptEvents)
5280 AggregateScriptEvents |= s;
5284 uint objectflagupdate = 0;
5288 ((AggregateScriptEvents &
scriptEvents.touch_end) != 0) ||
5289 ((AggregateScriptEvents &
scriptEvents.touch_start) != 0)
5292 objectflagupdate |= (uint)
PrimFlags.Touch;
5297 objectflagupdate |= (uint)
PrimFlags.Money;
5302 objectflagupdate |= (uint)
PrimFlags.AllowInventoryDrop;
5329 UpdatePhysicsSubscribedEvents();
5340 LocalFlags = (
PrimFlags)objectflagupdate;
5342 if (ParentGroup != null && ParentGroup.RootPart ==
this)
5344 ParentGroup.aggregateScriptEvents();
5350 ScheduleFullUpdate();
5356 m_cameraAtOffset = v;
5361 m_cameraEyeOffset = v;
5366 m_forceMouselook = force;
5371 return m_cameraAtOffset;
5376 return m_cameraEyeOffset;
5381 return m_forceMouselook;
5386 return String.Format(
"{0} {1} (parent {2}))", Name,
UUID, ParentGroup);
5389 #endregion Public Methods
5393 if (ParentGroup.IsDeleted)
5396 if (ParentGroup.IsAttachment
5397 && (ParentGroup.RootPart !=
this
5398 || ParentGroup.AttachedAvatar != remoteClient.
AgentId && ParentGroup.HasPrivateAttachmentPoint))
5403 remoteClient.SendEntityUpdate(
5405 PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
5406 | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
5408 ParentGroup.Scene.StatsReporter.AddObjectUpdates(1);
5413 ParentGroup.AddScriptLPS(count);
5428 if ((item.
Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
5434 EveryoneMask = item.EveryOnePermissions;
5435 NextOwnerMask = item.NextPermissions;
5439 if ((item.
Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
5441 if ((item.
Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
5443 if ((item.
Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
5453 if (OwnerID != item.
Owner)
5458 ApplyNextOwnerPermissions();
5462 LastOwnerID = OwnerID;
5463 OwnerID = item.Owner;
5464 Inventory.ChangeInventoryOwner(item.Owner);
5472 private void LogPermissions(String message)
5474 PermissionsUtil.LogPermissions(Name, message, BaseMask, OwnerMask, NextOwnerMask);
5483 OwnerMask &= NextOwnerMask;
5484 EveryoneMask &= NextOwnerMask | (uint)PermissionMask.Export;
5486 Inventory.ApplyNextOwnerPermissions();
5496 if (pa == null || !pa.
IsPhysical || APIDStrength < 0.04)
5502 Quaternion currRot = GetWorldRotation();
5503 currRot.Normalize();
5506 Quaternion dR = currRot / APIDTarget;
5509 Vector3 axis = Vector3.UnitX;
5511 dR.GetAxisAngle(out axis, out angle);
5512 axis = axis * currRot;
5515 float strength = 1.0f / APIDStrength;
5516 if (strength > 1.0) strength = 1.0f;
5523 ParentGroup.QueueForUpdateCheck();
5526 catch (Exception ex)
5528 m_log.Error(
"[Physics] " + ex);
5534 Color color = Color;
5535 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A));
5540 List<UUID> inv = Inventory.GetInventoryList();
5542 foreach (
UUID itemID
in inv)
5545 item.OwnerChanged =
false;
5546 Inventory.UpdateInventoryItem(item,
false,
false);
5560 lock (ParentGroup.m_sittingAvatars)
5562 if (IsSitTargetSet && SitTargetAvatar ==
UUID.Zero)
5563 SitTargetAvatar = sp.UUID;
5565 if (m_sittingAvatars == null)
5566 m_sittingAvatars =
new HashSet<ScenePresence>();
5568 if (m_sittingAvatars.Add(sp))
5570 if(!ParentGroup.m_sittingAvatars.Contains(sp))
5571 ParentGroup.m_sittingAvatars.Add(sp);
5588 protected internal bool RemoveSittingAvatar(ScenePresence sp)
5590 lock (ParentGroup.m_sittingAvatars)
5592 if (SitTargetAvatar == sp.UUID)
5593 SitTargetAvatar = UUID.Zero;
5595 if (m_sittingAvatars == null)
5598 if (m_sittingAvatars.Remove(sp))
5600 if (m_sittingAvatars.Count == 0)
5601 m_sittingAvatars = null;
5603 ParentGroup.m_sittingAvatars.Remove(sp);
5619 lock (ParentGroup.m_sittingAvatars)
5621 if (m_sittingAvatars == null)
5624 return new HashSet<ScenePresence>(m_sittingAvatars);
5635 lock (ParentGroup.m_sittingAvatars)
5637 if (m_sittingAvatars == null)
5640 return m_sittingAvatars.Count;
void SetHoverHeight(float height, PIDHoverType hoverType, float tau)
Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds...
int GetNumberOfSides()
Get the number of sides that this part has.
void PhysicsOutOfBounds(Vector3 pos)
void SetFaceColorAlpha(int face, Vector3 color, double?alpha)
Set the color & alpha of prim faces
void SendScheduledUpdates()
Tell all the prims which have had updates scheduled
void UpdateOffSet(Vector3 newPos)
Update this part's offset position.
void ApplyNextOwnerPermissions()
void RemoveScriptEvents(UUID scriptid)
void SetVehicleRotationParam(int param, Quaternion rotation)
void UpdatePermissions(UUID AgentID, byte field, uint localID, uint mask, byte addRemTF)
Update permissions on the SOP. Should only be called from SOG.UpdatePermissions because the SOG will ...
Quaternion GetWorldRotation()
Gets the rotation of this prim offset by the group rotation
IClientAPI ControllingClient
void SendFullUpdateToClient(IClientAPI remoteClient)
Sends a full update to the client
scriptEvents AggregateScriptEvents
void SendTerseUpdateToAllClientsInternal()
Send a terse update to all clients
EntityIntersection TestIntersection(Ray iray, Quaternion parentrot)
void SendFullUpdateToAllClients()
void DoPhysicsPropertyUpdateForNinjaJoint(bool UsePhysics, bool isNew)
Called back by asynchronous asset fetch.
List< DetectedObject > Colliders
static void HasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, out bool hasDimple, out bool hasProfileCut)
Tell us if this object has cut, hollow, dimple, and other factors affecting the number of faces ...
void UpdateExtraParam(ushort type, bool inUse, byte[] data)
SceneObjectGroup m_parentGroup
OpenSim.Server.Handlers.Simulation.Utils Utils
void UpdateRotation(Quaternion rot)
This updates the part's rotation and sends out an update to clients if necessary. ...
void SetBuoyancy(float fvalue)
Vector3 GetCameraAtOffset()
Vector3 m_lastAngularVelocity
PrimType GetPrimType()
Tell us what type this prim is
void SetText(string text)
Set the text displayed for this part.
void ClearUpdateSchedule()
Clear all pending updates of parts to clients
Vector3 GetGeometricCenter()
void SendCollisionSound(UUID soundID, double volume, Vector3 position)
void ApplyPhysics(uint _ObjectFlags, bool _VolumeDetectActive, bool building)
Apply physics to this part.
void AddNewParticleSystem(Primitive.ParticleSystem pSystem)
A dictionary containing task inventory items. Indexed by item UUID.
void ApplyAngularImpulse(Vector3 impulsei, bool localGlobalTF)
hook to the physics scene to apply angular impulse This is sent up to the group, which then finds the...
void SetCameraAtOffset(Vector3 v)
double GetDistanceTo(Vector3 a, Vector3 b)
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
SceneObjectPart Copy(uint plocalID, UUID AgentID, UUID GroupID, int linkNum, bool userExposed)
Duplicates this part.
PrimFlags Flags
Property flags. See OpenMetaverse.PrimFlags
void MoveToTarget(Vector3 target, float tau)
void ScheduleFullUpdateIfNone()
Represents an item in a task inventory
void SetScriptEvents(UUID scriptid, int events)
Set the events that this part will pass on to listeners.
void UpdateTextureEntry(byte[] serializedTextureEntry)
If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physi...
void AddTextureAnimation(Primitive.TextureAnimation pTexAnim)
void SetGroup(UUID groupID, IClientAPI client)
void SetCameraEyeOffset(Vector3 v)
void ScheduleTerseUpdate()
Schedule a terse update for this prim. Terse updates only send position, rotation, velocity and rotational velocity information.
bool PropagatePermissions()
virtual UUID Owner
The agent who's inventory this is contained by
void Resize(Vector3 scale)
Set the scale of this part.
void SetFloatOnWater(int floatYN)
This class stores and retrieves dynamic objects.
void SetVelocity(Vector3 pVel, bool localGlobalTF)
void StoreUndoState(ObjectChangeType change)
Quaternion m_lastRotation
SceneObjectPartInventory m_inventory
Used to pass collision information to OnCollisionUpdate listeners.
void PhysicsRequestingTerseUpdate()
void RotLookAt(Quaternion target, float strength, float damping)
HashSet< ScenePresence > GetSittingAvatars()
Get a copy of the list of sitting avatars.
void SetAngularImpulse(Vector3 torquei, bool localGlobalTF)
hook to the physics scene to apply angular impulse This is sent up to the group, which then finds the...
void ClonePermissions(SceneObjectPart source)
bool CollisionFilteredOut(UUID objectID, string objectName)
void SendPropertiesToClient(IClientAPI client)
Send this part's properties (name, description, inventory serial, base mask, etc.) to a client ...
OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion rotation
void PhysicsCollision(EventArgs e)
virtual void OnGrab(Vector3 offsetPos, IClientAPI remoteClient)
int GetSittingAvatarsCount()
Gets the number of sitting avatars.
static SceneObjectPart FromXml(XmlReader xmlReader)
Restore this part from the serialized xml representation.
Vector3 GetCenterOfMass()
OpenSim.Framework.PermissionMask PermissionMask
void SetVehicleVectorParam(int param, Vector3 value)
void ApplyImpulse(Vector3 impulsei, bool localGlobalTF)
hook to the physics scene to apply impulse This is sent up to the group, which then finds the root pr...
void UpdateExtraPhysics(ExtraPhysicsData physdata)
void setRotationOffset(Quaternion q)
byte ConvertScriptUintToByte(uint indata)
void SetReturnAtEdge(bool p)
Inventory Item - contains all the properties associated with an individual inventory piece...
void ScriptSetPhysicsStatus(bool UsePhysics)
void AdjustSoundGain(double volume)
OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.SculptType SculptType
This class stores and retrieves dynamic attributes.
Vector3 GetCameraEyeOffset()
void aggregateScriptEvents()
ScenePermissions Permissions
override string ToString()
void SetForceMouselook(bool force)
void SendTerseUpdateToClient(IClientAPI remoteClient)
void AddFlag(PrimFlags flag)
PhysicsActor PhysActor
The representation of this part in the physics scene.
void SetText(string text, Vector3 color, double alpha)
Set the text displayed for this part.
void SetParentLocalId(uint localID)
byte DefaultPhysicsShapeType()
void StartLookAt(Quaternion target, float strength, float damping)
void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock)
Update the shape of this part.
void SendTerseUpdateToAllClients()
void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
Do a physics propery update for this part. now also updates phantom and volume detector ...
void UpdateSlice(float begin, float end)
SceneObjectPart()
No arg constructor called by region restore db code
void RemFlag(PrimFlags flag)
void TriggerScriptChangedEvent(Changed val)
void SetParent(SceneObjectGroup parent)
Set the parent group of this prim.
void ResetOwnerChangeFlag()
int GetAxisRotation(int axis)
void UpdateGroupPosition(Vector3 newPos)
void SetAxisRotation(int axis, int rotate)
Vector3 m_lastAcceleration
Vector3 GetPartCenterOfMass()
uint TimeStampLastActivity
void SetAngularVelocity(Vector3 pAngVel, bool localGlobalTF)
bool IsWaitingForFirstSpinUpdatePacket
void ToXml(XmlTextWriter xmlWriter)
Serialize this part to xml.
void RemoveParticleSystem()
Interface to an entity's (SceneObjectPart's) inventory
void SetVehicleType(int type)
void SetVehicleFlags(int param, bool remove)
Material
Material type for a primitive
void SendFullUpdateToAllClientsInternal()
Send a full update for this part to all clients.
abstract Quaternion Orientation
uint GetEffectiveObjectFlags()
Vector3 m_angularVelocity
void ApplyPermissionsOnRez(InventoryItemBase item, bool userInventory, Scene scene)
Sets a prim's owner and permissions when it's rezzed.
void UpdateAngularVelocity(Vector3 avel)
Update angular velocity and schedule terse update.
void RemoveFromPhysics()
This removes the part from the physics scene.
void UpdateTextureEntry(Primitive.TextureEntry newTex)
Update the texture entry for this part.
void SetForce(Vector3 force)
void setOffsetPosition(Vector3 pos)
static readonly uint SLAM
void SetStatusSandbox(bool p)
void setGroupPosition(Vector3 pos)
void SetPhysicsAxisRotation()
Vector3 GetWorldPosition()
Method for a prim to get it's world position from the group.
void ResetIDs(int linkNum)
Reset UUIDs for this part. This involves generate this part's own UUID and generating new UUIDs for a...
PrimitiveBaseShape m_shape
void SetDieAtEdge(bool p)
EntityIntersection TestIntersectionOBB(Ray iray, Quaternion parentrot, bool frontFacesOnly, bool faceCenters)
void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos)
Sends a full update to the client
void AddScriptLPS(int count)
void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD, bool building)
Update the flags on this prim. This covers properties such as phantom, physics and temporary...
void SetVehicleFloatParam(int param, float value)
SceneObjectPart(UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, Quaternion rotationOffset, Vector3 offsetPosition)
Create a completely new SceneObjectPart (prim). This will need to be added separately to a SceneObjec...
uint ParentID
If the avatar is sitting, the local ID of the prim that it's sitting on. If not sitting then zero...
void ScheduleFullUpdate()
Schedules this prim for a full update