diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 4f65cc7..27639ea 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -180,7 +180,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
180 | set | 180 | set |
181 | { | 181 | { |
182 | LLVector3 val = value; | 182 | LLVector3 val = value; |
183 | if (val.X > 257f || val.X < -1f || val.Y > 257f || val.Y < -1f) | 183 | if ((val.X > 257f || val.X < -1f || val.Y > 257f || val.Y < -1f) && !m_rootPart.m_IsAttachment) |
184 | { | 184 | { |
185 | m_scene.CrossPrimGroupIntoNewRegion(val, this); | 185 | m_scene.CrossPrimGroupIntoNewRegion(val, this); |
186 | } | 186 | } |
@@ -612,6 +612,42 @@ namespace OpenSim.Region.Environment.Scenes | |||
612 | m_rootPart = part; | 612 | m_rootPart = part; |
613 | } | 613 | } |
614 | 614 | ||
615 | |||
616 | public void AttachToAgent(LLUUID agentID, uint attachmentpoint) | ||
617 | { | ||
618 | ScenePresence avatar = m_scene.GetScenePresence(agentID); | ||
619 | if (avatar != null) | ||
620 | { | ||
621 | m_rootPart.m_attachedAvatar = agentID; | ||
622 | m_rootPart.SetParentLocalId(avatar.LocalId); | ||
623 | m_rootPart.SetAttachmentPoint(attachmentpoint); | ||
624 | m_rootPart.m_IsAttachment = true; | ||
625 | if (m_rootPart.PhysActor != null) | ||
626 | { | ||
627 | m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor); | ||
628 | m_rootPart.PhysActor = null; | ||
629 | AbsolutePosition = LLVector3.Zero; | ||
630 | } | ||
631 | m_rootPart.ScheduleFullUpdate(); | ||
632 | } | ||
633 | } | ||
634 | |||
635 | public void DetachToGround() | ||
636 | { | ||
637 | ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.m_attachedAvatar); | ||
638 | LLVector3 detachedpos = new LLVector3(127f,127f,127f); | ||
639 | if (avatar != null) | ||
640 | { | ||
641 | detachedpos = avatar.AbsolutePosition; | ||
642 | } | ||
643 | AbsolutePosition = detachedpos; | ||
644 | m_rootPart.m_attachedAvatar = LLUUID.Zero; | ||
645 | m_rootPart.SetParentLocalId(0); | ||
646 | m_rootPart.SetAttachmentPoint((byte)0); | ||
647 | m_rootPart.m_IsAttachment = false; | ||
648 | m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_scene.m_physicalPrim); | ||
649 | m_rootPart.ScheduleFullUpdate(); | ||
650 | } | ||
615 | /// <summary> | 651 | /// <summary> |
616 | /// | 652 | /// |
617 | /// </summary> | 653 | /// </summary> |