本文整理汇总了C#中OpenSim.Region.Framework.Scenes.SceneObjectGroup.GetSavedAttachmentPoint方法的典型用法代码示例。如果您正苦于以下问题:C# SceneObjectGroup.GetSavedAttachmentPoint方法的具体用法?C# SceneObjectGroup.GetSavedAttachmentPoint怎么用?C# SceneObjectGroup.GetSavedAttachmentPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.SceneObjectGroup
的用法示例。
在下文中一共展示了SceneObjectGroup.GetSavedAttachmentPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindAttachmentPoint
/// <summary>
/// Attach the object to the avatar
/// </summary>
/// <param name="remoteClient">The client that is having the attachment done</param>
/// <param name="localID">The localID (SceneObjectPart) that is being attached (for the attach script event)</param>
/// <param name="group">The group (SceneObjectGroup) that is being attached</param>
/// <param name="AttachmentPt">The point to where the attachment will go</param>
/// <param name="item">If this is not null, it saves a query in this method to the InventoryService
/// This is the Item that the object is in (if it is in one yet)</param>
protected void FindAttachmentPoint(IClientAPI remoteClient, uint localID, SceneObjectGroup group,
int AttachmentPt, InventoryItemBase item)
{
//Make sure that we arn't over the limit of attachments
SceneObjectGroup[] attachments = GetAttachmentsForAvatar(remoteClient.AgentId);
if (attachments.Length + 1 > m_maxNumberOfAttachments)
{
//Too many
remoteClient.SendAgentAlertMessage(
"You are wearing too many attachments. Take one off to attach this object", false);
return;
}
Vector3 attachPos = group.GetAttachmentPos();
if(!m_allowMultipleAttachments)
AttachmentPt &= 0x7f; //Disable it!
//Did the attachment change position or attachment point?
bool changedPositionPoint = false;
// If the attachment point isn't the same as the one previously used
// set it's offset position = 0 so that it appears on the attachment point
// and not in a weird location somewhere unknown.
//Simplier terms: the attachment point changed, set it to the default 0,0,0 location
if ((AttachmentPt & 0x7f) != 0 && (AttachmentPt & 0x7f) != (int)group.GetAttachmentPoint())
{
attachPos = Vector3.Zero;
changedPositionPoint = true;
}
else
{
// AttachmentPt 0 means the client chose to 'wear' the attachment.
if ((AttachmentPt & 0x7f) == 0)
{
// Check object for stored attachment point
AttachmentPt = (int)group.GetSavedAttachmentPoint();
attachPos = group.GetAttachmentPos();
}
//Check state afterwards... use the newer GetSavedAttachmentPoint and Pos above first
if ((AttachmentPt & 0x7f) == 0)
{
// Check object for older stored attachment point
AttachmentPt = group.RootPart.Shape.State;
//attachPos = group.AbsolutePosition;
}
// if we still didn't find a suitable attachment point, force it to the default
//This happens on the first time an avatar 'wears' an object
if ((AttachmentPt & 0x7f) == 0)
{
// Stick it on right hand with Zero Offset from the attachment point.
AttachmentPt = (int)AttachmentPoint.RightHand;
//Default location
attachPos = Vector3.Zero;
changedPositionPoint = true;
}
}
group.HasGroupChanged = changedPositionPoint;
//Update where we are put
group.SetAttachmentPoint((byte)AttachmentPt);
//Fix the position with the one we found
group.AbsolutePosition = attachPos;
// Remove any previous attachments
ScenePresence presence = m_scene.GetScenePresence(remoteClient.AgentId);
if (presence == null)
return;
UUID itemID = UUID.Zero;
//Check for multiple attachment bits
//If the numbers are the same, it wants to have the old attachment taken off
if ((AttachmentPt & 0x7f) == AttachmentPt)
{
foreach (SceneObjectGroup grp in attachments)
{
if (grp.GetAttachmentPoint() == (byte)AttachmentPt)
{
itemID = grp.GetFromItemID();
break;
}
}
if (itemID != UUID.Zero)
DetachSingleAttachmentToInventory(itemID, remoteClient);
}
itemID = group.GetFromItemID();
group.RootPart.AttachedAvatar = presence.UUID;
//Anakin Lohner bug #3839
//.........这里部分代码省略.........