本文整理汇总了C#中OpenSim.Region.Framework.Scenes.ScenePresence.AddAttachment方法的典型用法代码示例。如果您正苦于以下问题:C# ScenePresence.AddAttachment方法的具体用法?C# ScenePresence.AddAttachment怎么用?C# ScenePresence.AddAttachment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.ScenePresence
的用法示例。
在下文中一共展示了ScenePresence.AddAttachment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AttachToAgent
/// <summary>
/// Attach this scene object to the given avatar.
/// </summary>
/// <param name="agentID"></param>
/// <param name="attachmentpoint"></param>
/// <param name="AttachOffset"></param>
private void AttachToAgent(
ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
{
if (avatar != null)
{
// don't attach attachments to child agents
if (avatar.IsChildAgent) return;
// Remove from database and parcel prim count
m_scene.DeleteFromStorage(so.UUID);
m_scene.EventManager.TriggerParcelPrimCountTainted();
so.AttachedAvatar = avatar.UUID;
if (so.RootPart.PhysActor != null)
{
m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor);
so.RootPart.PhysActor = null;
}
so.AbsolutePosition = attachOffset;
so.RootPart.AttachedPos = attachOffset;
so.IsAttachment = true;
so.RootPart.SetParentLocalId(avatar.LocalId);
so.AttachmentPoint = attachmentpoint;
avatar.AddAttachment(this);
if (!silent)
{
// Killing it here will cause the client to deselect it
// It then reappears on the avatar, deselected
// through the full update below
//
if (IsSelected)
{
m_scene.SendKillObject(new List<uint> { m_rootPart.LocalId });
}
IsSelected = false; // fudge....
ScheduleGroupForFullUpdate();
}
}
else
{
m_log.WarnFormat(
"[SOG]: Tried to add attachment {0} to avatar with UUID {1} in region {2} but the avatar is not present",
UUID, avatar.ControllingClient.AgentId, Scene.RegionInfo.RegionName);
}
}
示例2: AttachToAgent
/// <summary>
/// Attach this scene object to the given avatar.
/// </summary>
///
/// This isn't publicly available since attachments should always perform the corresponding inventory
/// operation (to show the attach in user inventory and update the asset with positional information).
///
/// <param name="sp"></param>
/// <param name="so"></param>
/// <param name="attachmentpoint"></param>
/// <param name="AttachOffset"></param>
/// <param name="silent"></param>
protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, int attachmentpoint, Vector3 AttachOffset, bool silent)
{
// don't attach attachments to child agents
if (avatar.IsChildAgent) return;
// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name);
so.DetachFromBackup();
// Remove from database and parcel prim count
m_scene.DeleteFromStorage(so.UUID);
m_scene.EventManager.TriggerParcelPrimCountTainted();
so.RootPart.AttachedAvatar = avatar.UUID;
//Anakin Lohner bug #3839
SceneObjectPart[] parts = so.Parts;
for (int i = 0; i < parts.Length; i++)
parts[i].AttachedAvatar = avatar.UUID;
if (so.RootPart.PhysActor != null)
{
m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor);
so.RootPart.PhysActor = null;
}
so.AbsolutePosition = AttachOffset;
so.RootPart.AttachedPos = AttachOffset;
so.RootPart.IsAttachment = true;
so.RootPart.SetParentLocalId(avatar.LocalId);
so.SetAttachmentPoint(Convert.ToByte(attachmentpoint));
avatar.AddAttachment(so);
if (!silent)
{
// Killing it here will cause the client to deselect it
// It then reappears on the avatar, deselected
// through the full update below
//
if (so.IsSelected)
{
m_scene.SendKillObject(so.RootPart.LocalId);
}
so.IsSelected = false; // fudge....
so.ScheduleGroupForFullUpdate(PrimUpdateFlags.FullUpdate);
}
// In case it is later dropped again, don't let
// it get cleaned up
so.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
so.HasGroupChanged = false;
}
示例3: AttachToAgent
/// <summary>
/// Attach this scene object to the given avatar.
/// </summary>
///
/// This isn't publicly available since attachments should always perform the corresponding inventory
/// operation (to show the attach in user inventory and update the asset with positional information).
///
/// <param name="sp"></param>
/// <param name="so"></param>
/// <param name="attachmentpoint"></param>
/// <param name="AttachOffset"></param>
/// <param name="silent"></param>
protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, int attachmentpoint, Vector3 AttachOffset)
{
// don't attach attachments to child agents
if (avatar.IsChildAgent) return;
// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name);
// Remove from database and parcel prim count
IBackupModule backup = so.Scene.RequestModuleInterface<IBackupModule>();
if (backup != null)
backup.DeleteFromStorage(so.UUID);
so.RootPart.AttachedAvatar = avatar.UUID;
//Anakin Lohner bug #3839
SceneObjectPart[] parts = so.Parts;
for (int i = 0; i < parts.Length; i++)
parts[i].AttachedAvatar = avatar.UUID;
if (so.RootPart.PhysActor != null)
{
m_scene.SceneGraph.PhysicsScene.RemovePrim(so.RootPart.PhysActor);
so.RootPart.PhysActor = null;
}
so.AbsolutePosition = AttachOffset;
so.RootPart.AttachedPos = AttachOffset;
so.RootPart.IsAttachment = true;
so.RootPart.SetParentLocalId(avatar.LocalId);
so.SetAttachmentPoint(Convert.ToByte(attachmentpoint));
avatar.AddAttachment(so);
// Killing it here will cause the client to deselect it
// It then reappears on the avatar, deselected
// through the full update below
//
if (so.IsSelected)
{
m_scene.ForEachClient(delegate(IClientAPI client)
{
client.SendKillObject(m_scene.RegionInfo.RegionHandle, new ISceneEntity[] { so.RootPart });
});
foreach (SceneObjectPart part in so.ChildrenList)
{
part.CreateSelected = true;
}
}
//NOTE: This MUST be here, otherwise we limit full updates during attachments when they are selected and it will block the first update.
// So until that is changed, this MUST stay. The client will instantly reselect it, so this value doesn't stay borked for long.
so.IsSelected = false;
so.ScheduleGroupUpdate(PrimUpdateFlags.FullUpdate);
// In case it is later dropped again, don't let
// it get cleaned up
so.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
so.HasGroupChanged = false;
}