From aa8aee90a35458f1f601ca23e2298b212782d0a3 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Thu, 24 Apr 2008 11:32:41 +0000 Subject: * Adds much better support for attachments that you right click on in world. * Your friends can see your attachments now. People who appear in the sim after you've attached something can also see your attachments. * You can position & rotate your attachments now. Positions do *not* save. * You can detach attachments now the regular way. * Attachments do not cross into other regions with you..(this isn't too far off) * Updated ODE to not request terse updates on child prim. --- .../Region/Environment/Scenes/SceneObjectGroup.cs | 38 +++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs') 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 set { LLVector3 val = value; - if (val.X > 257f || val.X < -1f || val.Y > 257f || val.Y < -1f) + if ((val.X > 257f || val.X < -1f || val.Y > 257f || val.Y < -1f) && !m_rootPart.m_IsAttachment) { m_scene.CrossPrimGroupIntoNewRegion(val, this); } @@ -612,6 +612,42 @@ namespace OpenSim.Region.Environment.Scenes m_rootPart = part; } + + public void AttachToAgent(LLUUID agentID, uint attachmentpoint) + { + ScenePresence avatar = m_scene.GetScenePresence(agentID); + if (avatar != null) + { + m_rootPart.m_attachedAvatar = agentID; + m_rootPart.SetParentLocalId(avatar.LocalId); + m_rootPart.SetAttachmentPoint(attachmentpoint); + m_rootPart.m_IsAttachment = true; + if (m_rootPart.PhysActor != null) + { + m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor); + m_rootPart.PhysActor = null; + AbsolutePosition = LLVector3.Zero; + } + m_rootPart.ScheduleFullUpdate(); + } + } + + public void DetachToGround() + { + ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.m_attachedAvatar); + LLVector3 detachedpos = new LLVector3(127f,127f,127f); + if (avatar != null) + { + detachedpos = avatar.AbsolutePosition; + } + AbsolutePosition = detachedpos; + m_rootPart.m_attachedAvatar = LLUUID.Zero; + m_rootPart.SetParentLocalId(0); + m_rootPart.SetAttachmentPoint((byte)0); + m_rootPart.m_IsAttachment = false; + m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_scene.m_physicalPrim); + m_rootPart.ScheduleFullUpdate(); + } /// /// /// -- cgit v1.1