当前位置: 首页>>代码示例>>C#>>正文


C# IScene.GetSceneObjectPart方法代码示例

本文整理汇总了C#中IScene.GetSceneObjectPart方法的典型用法代码示例。如果您正苦于以下问题:C# IScene.GetSceneObjectPart方法的具体用法?C# IScene.GetSceneObjectPart怎么用?C# IScene.GetSceneObjectPart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IScene的用法示例。


在下文中一共展示了IScene.GetSceneObjectPart方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Reload

 public void Reload (IScene scene, float direction)
 {
     foreach (KeyValuePair<UUID, PhysicsState> kvp in m_activePrims)
     {
         ISceneChildEntity childPrim = scene.GetSceneObjectPart (kvp.Key);
         if (childPrim != null && childPrim.PhysActor != null)
             ResetPrim (childPrim.PhysActor, kvp.Value, direction);
         else
         {
             IScenePresence sp = scene.GetScenePresence (kvp.Key);
             if (sp != null)
                 ResetAvatar (sp.PhysicsActor, kvp.Value, direction);
         }
     }
 }
开发者ID:NickyPerian,项目名称:Aurora-Sim,代码行数:15,代码来源:PhysicsStateModule.cs

示例2: CreateCharacter

        public void CreateCharacter(UUID primID, IScene scene)
        {
            RemoveCharacter(primID);
            ISceneEntity entity = scene.GetSceneObjectPart(primID).ParentEntity;
            Bot bot = new Bot();
            bot.Initialize(entity);

            m_bots.Add(primID, bot);
            AddTagToBot(primID, "AllBots", bot.AvatarCreatorID);
        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:10,代码来源:BotManager.cs

示例3: RemoveAvatar

        public void RemoveAvatar(UUID avatarID, IScene scene, UUID userAttempting)
        {
            IEntity sp = scene.GetScenePresence(avatarID);
            if (sp == null)
            {
                sp = scene.GetSceneObjectPart(avatarID);
                if (sp == null)
                    return;
                sp = ((ISceneChildEntity)sp).ParentEntity;
            }
            if (!CheckPermission(sp, userAttempting))
                return;

            RemoveAllTagsFromBot(avatarID, userAttempting);
            if (!m_bots.Remove(avatarID))
                return;
            //Kill the agent
            IEntityTransferModule module = scene.RequestModuleInterface<IEntityTransferModule>();
            module.IncomingCloseAgent(scene, avatarID);
        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:20,代码来源:BotManager.cs

示例4: SimChat

        public void SimChat(string message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
                            UUID fromID, bool fromAgent, bool broadcast, float range, UUID ToAgentID, IScene scene)
        {
            OSChatMessage args = new OSChatMessage
                                     {
                                         Message = message,
                                         Channel = channel,
                                         Type = type,
                                         Position = fromPos,
                                         Range = range,
                                         SenderUUID = fromID,
                                         Scene = scene,
                                         ToAgentID = ToAgentID
                                     };


            if (fromAgent)
            {
                IScenePresence user = scene.GetScenePresence(fromID);
                if (user != null)
                    args.Sender = user.ControllingClient;
            }
            else
            {
                args.SenderObject = scene.GetSceneObjectPart(fromID);
            }

            args.From = fromName;
            //args.

            if (broadcast)
            {
                OnChatBroadcast(scene, args);
                scene.EventManager.TriggerOnChatBroadcast(scene, args);
            }
            else
            {
                OnChatFromWorld(scene, args);
                scene.EventManager.TriggerOnChatFromWorld(scene, args);
            }
        }
开发者ID:JAllard,项目名称:Aurora-Sim,代码行数:41,代码来源:AuroraChatModule.cs

示例5: findPrim

        private ISceneChildEntity findPrim(UUID objectID, out string ObjectRegionName, IScene s)
        {
            ISceneChildEntity part = s.GetSceneObjectPart(objectID);
            if (part != null)
            {
                ObjectRegionName = s.RegionInfo.RegionName;
                int localX = s.RegionInfo.RegionLocX;
                int localY = s.RegionInfo.RegionLocY;
                ObjectRegionName = ObjectRegionName + " (" + localX + ", " + localY + ")";
                return part;
            }

            ObjectRegionName = string.Empty;
            return null;
        }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:15,代码来源:EmailModule.cs

示例6: CanViewNotecard

        /// <summary>
        ///   Check whether the specified user can view the given notecard
        /// </summary>
        /// <param name = "script"></param>
        /// <param name = "objectID"></param>
        /// <param name = "user"></param>
        /// <param name = "scene"></param>
        /// <returns></returns>
        private bool CanViewNotecard(UUID notecard, UUID objectID, UUID user, IScene scene)
        {
            DebugPermissionInformation(MethodBase.GetCurrentMethod().Name);
            if (m_bypassPermissions) return m_bypassPermissionsValue;

            DebugPermissionInformation(MethodBase.GetCurrentMethod().Name);
            if (m_bypassPermissions) return m_bypassPermissionsValue;

            if (IsAdministrator(user))
                return true;

            if (objectID == UUID.Zero) // User inventory
            {
                IInventoryService invService = m_scene.InventoryService;
                InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user);
                assetRequestItem = invService.GetItem(assetRequestItem);
                if (assetRequestItem == null) // Library item
                {
                    //Can't find, can't read
                    return false;
                }

                // SL is rather harebrained here. In SL, a script you
                // have mod/copy no trans is readable. This subverts
                // permissions, but is used in some products, most
                // notably Hippo door plugin and HippoRent 5 networked
                // prim counter.
                // To enable this broken SL-ism, remove Transfer from
                // the below expressions.
                // Trying to improve on SL perms by making a script
                // readable only if it's really full perms
                //
                if ((assetRequestItem.CurrentPermissions &
                     ((uint) PermissionMask.Modify |
                      (uint) PermissionMask.Copy |
                      (uint) PermissionMask.Transfer)) !=
                    ((uint) PermissionMask.Modify |
                     (uint) PermissionMask.Copy |
                     (uint) PermissionMask.Transfer))
                    return false;
            }
            else // Prim inventory
            {
                ISceneChildEntity part = scene.GetSceneObjectPart(objectID);

                if (part == null)
                {
                    MainConsole.Instance.Warn("[PERMISSIONS]: NULL PRIM IN canViewNotecard! " + objectID);
                    return false;
                }

                if (part.OwnerID != user)
                {
                    if (part.GroupID != UUID.Zero)
                    {
                        if (!IsGroupMember(part.GroupID, user, 0))
                            return false;

                        if ((part.GroupMask & (uint) PermissionMask.Modify) == 0)
                            return false;
                    }
                }
                else
                {
                    if ((part.OwnerMask & (uint) PermissionMask.Modify) == 0)
                        return false;
                }

                TaskInventoryItem ti = part.Inventory.GetInventoryItem(notecard);

                if (ti == null)
                    return false;

                if (ti.OwnerID != user)
                {
                    if (ti.GroupID == UUID.Zero)
                        return false;

                    if (!IsGroupMember(ti.GroupID, user, 0))
                        return false;
                }

                // Require full perms
                if ((ti.CurrentPermissions &
                     ((uint) PermissionMask.Modify |
                      (uint) PermissionMask.Copy |
                      (uint) PermissionMask.Transfer)) !=
                    ((uint) PermissionMask.Modify |
                     (uint) PermissionMask.Copy |
                     (uint) PermissionMask.Transfer))
                    return false;
            }
//.........这里部分代码省略.........
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:101,代码来源:PermissionsModule.cs

示例7: CanRunScript

        private bool CanRunScript(UUID script, UUID objectID, UUID user, IScene scene)
        {
            DebugPermissionInformation(MethodBase.GetCurrentMethod().Name);
            if (m_bypassPermissions) return m_bypassPermissionsValue;

            ISceneChildEntity part = scene.GetSceneObjectPart(objectID);

            if (part == null)
                return false;

            if (m_parcelManagement == null)
                return true;
            ILandObject parcel = m_parcelManagement.GetLandObject(part.AbsolutePosition.X, part.AbsolutePosition.Y);

            if (parcel == null)
                return false;

            if ((parcel.LandData.Flags & (int) ParcelFlags.AllowOtherScripts) != 0)
                return true;

            if ((parcel.LandData.Flags & (int) ParcelFlags.AllowGroupScripts) == 0)
            {
                //Only owner can run then
                return GenericParcelPermission(user, parcel, 0);
            }

            return GenericParcelPermission(user, parcel, (ulong) GroupPowers.None);
        }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:28,代码来源:PermissionsModule.cs

示例8: CanMoveObject

        private bool CanMoveObject(UUID objectID, UUID moverID, IScene scene)
        {
            DebugPermissionInformation(MethodBase.GetCurrentMethod().Name);
            if (m_bypassPermissions)
            {
                ISceneChildEntity part = scene.GetSceneObjectPart(objectID);
                if (part.OwnerID != moverID)
                {
                    if (part.ParentEntity != null && !part.ParentEntity.IsDeleted)
                    {
                        if (part.ParentEntity.IsAttachment)
                            return false;
                    }
                }
                return m_bypassPermissionsValue;
            }

            bool permission = GenericObjectPermission(moverID, objectID, true);
            if (!permission)
            {
                IEntity ent;
                if (!m_scene.Entities.TryGetValue(objectID, out ent))
                {
                    return false;
                }

                // The client
                // may request to edit linked parts, and therefore, it needs
                // to also check for SceneObjectPart

                // If it's not an object, we cant edit it.
                if (!(ent is ISceneEntity))
                {
                    return false;
                }

                ISceneEntity task = (ISceneEntity) ent;


                // UUID taskOwner = null;
                // Added this because at this point in time it wouldn't be wise for
                // the administrator object permissions to take effect.
                // UUID objectOwner = task.OwnerID;

                // Anyone can move
                if ((task.RootChild.EveryoneMask & PERM_MOVE) != 0)
                    permission = true;

                // Locked
                if ((task.RootChild.OwnerMask & PERM_LOCKED) == 0)
                    permission = false;
            }
            else
            {
                bool locked = false;
                IEntity ent;
                if (!m_scene.Entities.TryGetValue(objectID, out ent))
                {
                    return false;
                }

                // If it's not an object, we cant edit it.
                if (!(ent is ISceneEntity))
                {
                    return false;
                }

                ISceneEntity group = (ISceneEntity) ent;

                UUID objectOwner = group.OwnerID;
                locked = ((group.RootChild.OwnerMask & PERM_LOCKED) == 0);

                // This is an exception to the generic object permission.
                // Administrators who lock their objects should not be able to move them,
                // however generic object permission should return true.
                // This keeps locked objects from being affected by random click + drag actions by accident
                // and allows the administrator to grab or delete a locked object.

                // Administrators and estate managers are still able to click+grab locked objects not
                // owned by them in the scene
                // This is by design.

                if (locked && (moverID == objectOwner))
                    return false;
            }
            return permission;
        }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:87,代码来源:PermissionsModule.cs

示例9: CanInstantMessage

        private bool CanInstantMessage(UUID user, UUID target, IScene startScene)
        {
            DebugPermissionInformation(MethodBase.GetCurrentMethod().Name);
            if (m_bypassPermissions) return m_bypassPermissionsValue;

            // If the sender is an object, check owner instead
            //
            ISceneChildEntity part = startScene.GetSceneObjectPart(user);
            if (part != null)
                user = part.OwnerID;

            return GenericCommunicationPermission(user, target);
        }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:13,代码来源:PermissionsModule.cs

示例10: CanDuplicateObject

        private bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, IScene scene, Vector3 objectPosition)
        {
            DebugPermissionInformation(MethodBase.GetCurrentMethod().Name);
            if (m_bypassPermissions) return m_bypassPermissionsValue;

            if (!GenericObjectPermission(owner, objectID, true))
            {
                //They can't even edit the object
                return false;
            }

            ISceneChildEntity part = scene.GetSceneObjectPart(objectID);
            if (part == null)
                return false;

            if (part.OwnerID == owner)
                return ((part.OwnerMask & PERM_COPY) != 0);

            if (part.GroupID != UUID.Zero)
            {
                if ((part.OwnerID == part.GroupID) &&
                    ((owner != part.LastOwnerID) || ((part.GroupMask & PERM_TRANS) == 0)))
                    return false;

                if ((part.GroupMask & PERM_COPY) == 0)
                    return false;

                if (!IsGroupMember(part.GroupID, owner, (ulong) GroupPowers.ObjectManipulate))
                    return false;
            }

            //If they can rez, they can duplicate
            string reason;
            return CanRezObject(objectCount, owner, objectPosition, scene, out reason);
        }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:35,代码来源:PermissionsModule.cs

示例11: DistanceCulling

 public bool DistanceCulling (IScenePresence client, IEntity entity, IScene scene)
 {
     float DD = client.DrawDistance;
     if (DD < 32) //Limit to a small distance
         DD = 32;
     if (DD > scene.RegionInfo.RegionSizeX && 
         DD > scene.RegionInfo.RegionSizeY)
         return true; //Its larger than the region, no culling check even necessary
     Vector3 posToCheckFrom = client.GetAbsolutePosition();
     if (client.IsChildAgent)
     {
         if (m_cachedXOffset == 0 && m_cachedYOffset == 0) //Not found yet
         {
             IAgentInfoService agentInfoService = scene.RequestModuleInterface<IAgentInfoService>();
             if (agentInfoService != null)
             {
                 UserInfo info = agentInfoService.GetUserInfo (client.UUID.ToString ());
                 if (info != null)
                 {
                     GridRegion r = scene.GridService.GetRegionByUUID(scene.RegionInfo.ScopeID, 
                         info.CurrentRegionID);
                     if (r != null)
                     {
                         m_cachedXOffset = scene.RegionInfo.RegionLocX - r.RegionLocX;
                         m_cachedYOffset = scene.RegionInfo.RegionLocY - r.RegionLocY; 
                     }
                 }
             }
         }
         //We need to add the offset so that we can check from the right place in child regions
         if (m_cachedXOffset < 0)
             posToCheckFrom.X = scene.RegionInfo.RegionSizeX - (scene.RegionInfo.RegionSizeX + client.AbsolutePosition.X + m_cachedXOffset);
         if (m_cachedYOffset < 0)
             posToCheckFrom.Y = scene.RegionInfo.RegionSizeY - (scene.RegionInfo.RegionSizeY + client.AbsolutePosition.Y + m_cachedYOffset);
         if (m_cachedXOffset > scene.RegionInfo.RegionSizeX)
             posToCheckFrom.X = scene.RegionInfo.RegionSizeX - (scene.RegionInfo.RegionSizeX - (client.AbsolutePosition.X + m_cachedXOffset));
         if (m_cachedYOffset > scene.RegionInfo.RegionSizeY)
             posToCheckFrom.Y = scene.RegionInfo.RegionSizeY - (scene.RegionInfo.RegionSizeY - (client.AbsolutePosition.Y + m_cachedYOffset));
     }
     Vector3 entityPosToCheckFrom = Vector3.Zero;
     bool doHeavyCulling = false;
     if (entity is ISceneEntity)
     {
         doHeavyCulling = true;
         //We need to check whether this object is an attachment, and if so, set it so that we check from the avatar's
         // position, rather than from the offset of the attachment
         ISceneEntity sEntity = (ISceneEntity)entity;
         if (sEntity.RootChild.IsAttachment)
         {
             IScenePresence attachedAvatar = scene.GetScenePresence (sEntity.RootChild.AttachedAvatar);
             if (attachedAvatar != null)
                 entityPosToCheckFrom = attachedAvatar.AbsolutePosition;
         }
         else
             entityPosToCheckFrom = sEntity.RootChild.GetGroupPosition ();
     }
     else if (entity is IScenePresence)
     {
         //We need to check whether this presence is sitting on anything, so that we can check from the object's
         // position, rather than the offset position of the object that the avatar is sitting on
         IScenePresence pEntity = (IScenePresence)entity;
         if (pEntity.Sitting)
         {
             ISceneChildEntity sittingEntity = scene.GetSceneObjectPart (pEntity.SittingOnUUID);
             if (sittingEntity != null)
                 entityPosToCheckFrom = sittingEntity.GetGroupPosition ();
         }
         else
             entityPosToCheckFrom = pEntity.GetAbsolutePosition();
     }
     //If the distance is greater than the clients draw distance, its out of range
     if (Vector3.DistanceSquared (posToCheckFrom, entityPosToCheckFrom) >
         DD * DD) //Use squares to make it faster than having to do the sqrt
     {
         if (!doHeavyCulling)
             return false;//Don't do the hardcore checks
         ISceneEntity childEntity = (entity as ISceneEntity);
         if (childEntity != null && HardCullingCheck(childEntity))
         {
             #region Side culling check (X, Y, Z) plane checks
             if (Vector3.DistanceSquared (posToCheckFrom, entityPosToCheckFrom + new Vector3 (childEntity.OOBsize.X, 0, 0)) <
                 DD * DD) //Use squares to make it faster than having to do the sqrt
                 return true;
             if (Vector3.DistanceSquared (posToCheckFrom, entityPosToCheckFrom - new Vector3 (childEntity.OOBsize.X, 0, 0)) <
                 DD * DD) //Use squares to make it faster than having to do the sqrt
                 return true;
             if (Vector3.DistanceSquared (posToCheckFrom, entityPosToCheckFrom + new Vector3 (0, childEntity.OOBsize.Y, 0)) <
                 DD * DD) //Use squares to make it faster than having to do the sqrt
                 return true;
             if (Vector3.DistanceSquared (posToCheckFrom, entityPosToCheckFrom - new Vector3 (0, childEntity.OOBsize.Y, 0)) <
                 DD * DD) //Use squares to make it faster than having to do the sqrt
                 return true;
             if (Vector3.DistanceSquared (posToCheckFrom, entityPosToCheckFrom + new Vector3 (0, 0, childEntity.OOBsize.Z)) <
                 DD * DD) //Use squares to make it faster than having to do the sqrt
                 return true;
             if (Vector3.DistanceSquared (posToCheckFrom, entityPosToCheckFrom - new Vector3 (0, 0, childEntity.OOBsize.Z)) <
                 DD * DD) //Use squares to make it faster than having to do the sqrt
                 return true;
             #endregion
             #region Corner checks ((x,y),(-x,-y),(x,-y),(-x,y), (y,z),(-y,-z),(y,-z),(-y,z), (x,z),(-x,-z),(x,-z),(-x,z))
//.........这里部分代码省略.........
开发者ID:kchi059,项目名称:Aurora-Sim,代码行数:101,代码来源:Prioritizer.cs

示例12: DataReceived

            /// <summary>
            ///     Called once new texture data has been received for this updater.
            /// </summary>
            public void DataReceived(byte[] data, IScene scene)
            {
                ISceneChildEntity part = scene.GetSceneObjectPart(PrimID);

                if (part == null || data == null || data.Length <= 1)
                {
                    string msg =
                        String.Format("DynamicTextureModule: Error preparing image using URL {0}", Url);
                    IChatModule chatModule = scene.RequestModuleInterface<IChatModule>();
                    if (chatModule != null)
                        chatModule.SimChat(msg, ChatTypeEnum.Say, 0,
                                           part.ParentEntity.AbsolutePosition, part.Name, part.UUID, false, scene);
                    return;
                }

                byte[] assetData = null;
                AssetBase oldAsset = null;

                if (BlendWithOldTexture)
                {
                    Primitive.TextureEntryFace defaultFace = part.Shape.Textures.DefaultTexture;
                    if (defaultFace != null)
                    {
                        oldAsset = scene.AssetService.Get(defaultFace.TextureID.ToString());

                        if (oldAsset != null)
                            assetData = BlendTextures(data, oldAsset.Data, SetNewFrontAlpha, FrontAlpha, scene);
                    }
                }

                if (assetData == null)
                {
                    assetData = new byte[data.Length];
                    Array.Copy(data, assetData, data.Length);
                }

                AssetBase asset = null;

                if (LastAssetID != UUID.Zero)
                {
                    asset = scene.AssetService.Get(LastAssetID.ToString());
                    asset.Description = String.Format("URL image : {0}", Url);
                    asset.Data = assetData;
                    if ((asset.Flags & AssetFlags.Local) == AssetFlags.Local)
                    {
                        asset.Flags = asset.Flags & ~AssetFlags.Local;
                    }
                    if (((asset.Flags & AssetFlags.Temporary) == AssetFlags.Temporary) != ((Disp & DISP_TEMP) != 0))
                    {
                        if ((Disp & DISP_TEMP) != 0) asset.Flags |= AssetFlags.Temporary;
                        else asset.Flags = asset.Flags & ~AssetFlags.Temporary;
                    }
                    asset.ID = scene.AssetService.Store(asset);
                }
                else
                {
                    // Create a new asset for user
                    asset = new AssetBase(UUID.Random(), "DynamicImage" + Util.RandomClass.Next(1, 10000),
                                          AssetType.Texture,
                                          scene.RegionInfo.RegionID)
                                {Data = assetData, Description = String.Format("URL image : {0}", Url)};
                    if ((Disp & DISP_TEMP) != 0) asset.Flags = AssetFlags.Temporary;
                    asset.ID = scene.AssetService.Store(asset);
                }

                IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>();
                if (cacheLayerDecode != null)
                {
                    cacheLayerDecode.Decode(asset.ID, asset.Data);
                    cacheLayerDecode = null;
                    LastAssetID = asset.ID;
                }

                UUID oldID = UUID.Zero;

                lock (part)
                {
                    // mostly keep the values from before
                    Primitive.TextureEntry tmptex = part.Shape.Textures;

                    // remove the old asset from the cache
                    oldID = tmptex.DefaultTexture.TextureID;

                    if (Face == ALL_SIDES)
                    {
                        tmptex.DefaultTexture.TextureID = asset.ID;
                    }
                    else
                    {
                        try
                        {
                            Primitive.TextureEntryFace texface = tmptex.CreateFace((uint) Face);
                            texface.TextureID = asset.ID;
                            tmptex.FaceTextures[Face] = texface;
                        }
                        catch (Exception)
                        {
//.........这里部分代码省略.........
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:101,代码来源:DynamicTextureModule.cs

示例13: DistanceCulling

        public bool DistanceCulling(IScenePresence client, IEntity entity, IScene scene)
        {
            float DD = client.DrawDistance;
            if (DD < 32) //Limit to a small distance
                DD = 32;
            if (DD > scene.RegionInfo.RegionSizeX &&
                DD > scene.RegionInfo.RegionSizeY)
                return true; //Its larger than the region, no culling check even necessary
            Vector3 posToCheckFrom = client.GetAbsolutePosition();
            Vector3 entityPosToCheckFrom = Vector3.Zero;
            bool doHeavyCulling = false;
            if (entity is ISceneEntity)
            {
                doHeavyCulling = true;
                //We need to check whether this object is an attachment, and if so, set it so that we check from the avatar's
                // position, rather than from the offset of the attachment
                ISceneEntity sEntity = (ISceneEntity) entity;
                if (sEntity.RootChild.IsAttachment)
                {
                    IScenePresence attachedAvatar = scene.GetScenePresence(sEntity.RootChild.AttachedAvatar);
                    if (attachedAvatar != null)
                        entityPosToCheckFrom = attachedAvatar.AbsolutePosition;
                }
                else
                    entityPosToCheckFrom = sEntity.RootChild.GetGroupPosition();
            }
            else if (entity is IScenePresence)
            {
                //We need to check whether this presence is sitting on anything, so that we can check from the object's
                // position, rather than the offset position of the object that the avatar is sitting on
                IScenePresence pEntity = (IScenePresence) entity;
                if (pEntity.Sitting)
                {
                    ISceneChildEntity sittingEntity = scene.GetSceneObjectPart(pEntity.SittingOnUUID);
                    if (sittingEntity != null)
                        entityPosToCheckFrom = sittingEntity.GetGroupPosition();
                }
                else
                    entityPosToCheckFrom = pEntity.GetAbsolutePosition();
            }
            //If the distance is greater than the clients draw distance, its out of range
            if (Vector3.DistanceSquared(posToCheckFrom, entityPosToCheckFrom) >
                DD*DD) //Use squares to make it faster than having to do the sqrt
            {
                if (!doHeavyCulling)
                    return false; //Don't do the hardcore checks
                ISceneEntity childEntity = (entity as ISceneEntity);
                if (childEntity != null && HardCullingCheck(childEntity))
                {
                    #region Side culling check (X, Y, Z) plane checks

                    if (
                        Vector3.DistanceSquared(posToCheckFrom,
                                                entityPosToCheckFrom + new Vector3(childEntity.OOBsize.X, 0, 0)) <
                        DD*DD) //Use squares to make it faster than having to do the sqrt
                        return true;
                    if (
                        Vector3.DistanceSquared(posToCheckFrom,
                                                entityPosToCheckFrom - new Vector3(childEntity.OOBsize.X, 0, 0)) <
                        DD*DD) //Use squares to make it faster than having to do the sqrt
                        return true;
                    if (
                        Vector3.DistanceSquared(posToCheckFrom,
                                                entityPosToCheckFrom + new Vector3(0, childEntity.OOBsize.Y, 0)) <
                        DD*DD) //Use squares to make it faster than having to do the sqrt
                        return true;
                    if (
                        Vector3.DistanceSquared(posToCheckFrom,
                                                entityPosToCheckFrom - new Vector3(0, childEntity.OOBsize.Y, 0)) <
                        DD*DD) //Use squares to make it faster than having to do the sqrt
                        return true;
                    if (
                        Vector3.DistanceSquared(posToCheckFrom,
                                                entityPosToCheckFrom + new Vector3(0, 0, childEntity.OOBsize.Z)) <
                        DD*DD) //Use squares to make it faster than having to do the sqrt
                        return true;
                    if (
                        Vector3.DistanceSquared(posToCheckFrom,
                                                entityPosToCheckFrom - new Vector3(0, 0, childEntity.OOBsize.Z)) <
                        DD*DD) //Use squares to make it faster than having to do the sqrt
                        return true;

                    #endregion

                    #region Corner checks ((x,y),(-x,-y),(x,-y),(-x,y), (y,z),(-y,-z),(y,-z),(-y,z), (x,z),(-x,-z),(x,-z),(-x,z))

                    if (
                        Vector3.DistanceSquared(posToCheckFrom,
                                                entityPosToCheckFrom +
                                                new Vector3(childEntity.OOBsize.X, childEntity.OOBsize.Y, 0)) <
                        DD*DD) //Use squares to make it faster than having to do the sqrt
                        return true;
                    if (
                        Vector3.DistanceSquared(posToCheckFrom,
                                                entityPosToCheckFrom -
                                                new Vector3(childEntity.OOBsize.X, childEntity.OOBsize.Y, 0)) <
                        DD*DD) //Use squares to make it faster than having to do the sqrt
                        return true;
                    if (
                        Vector3.DistanceSquared(posToCheckFrom,
//.........这里部分代码省略.........
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:101,代码来源:Prioritizer.cs

示例14: Populate

        public void Populate(IScene scene)
        {
            ISceneChildEntity part = scene.GetSceneObjectPart(Key);
            Vector3 tmp;
            if (part == null) // Avatar, maybe?
            {
                IScenePresence presence = scene.GetScenePresence(Key);
                if (presence == null)
                    return;

                Name = presence.Name;
                Owner = Key;

                tmp = presence.AbsolutePosition;
                Position = new LSL_Types.Vector3(
                    tmp.X,
                    tmp.Y,
                    tmp.Z);
                Quaternion rtmp = presence.Rotation;
                Rotation = new LSL_Types.Quaternion(
                    rtmp.X,
                    rtmp.Y,
                    rtmp.Z,
                    rtmp.W);
                tmp = presence.Velocity;
                Velocity = new LSL_Types.Vector3(
                    tmp.X,
                    tmp.Y,
                    tmp.Z);

                Type = 0x01; // Avatar
                if (presence.Velocity != Vector3.Zero)
                    Type |= 0x02; // Active

                Group = presence.ControllingClient.ActiveGroupId;

                return;
            }

            part = part.ParentEntity.RootChild; // We detect objects only

            LinkNum = 0; // Not relevant

            Group = part.GroupID;
            Name = part.Name;
            Owner = part.OwnerID;
            Type = part.Velocity == Vector3.Zero ? 0x04 : 0x02;

            foreach (ISceneChildEntity child in part.ParentEntity.ChildrenEntities())
                if (child.Inventory.ContainsScripts())
                    Type |= 0x08; // Scripted

            tmp = part.AbsolutePosition;
            Position = new LSL_Types.Vector3(tmp.X,
                                             tmp.Y,
                                             tmp.Z);

            Quaternion wr = part.ParentEntity.GroupRotation;
            Rotation = new LSL_Types.Quaternion(wr.X, wr.Y, wr.Z, wr.W);

            tmp = part.Velocity;
            Velocity = new LSL_Types.Vector3(tmp.X,
                                             tmp.Y,
                                             tmp.Z);
        }
开发者ID:emperorstarfinder,项目名称:Virtual-Universe,代码行数:65,代码来源:Helpers.cs

示例15: RemoveAvatar

        public void RemoveAvatar(UUID avatarID, IScene scene, UUID userAttempting)
        {
            IEntity sp = scene.GetScenePresence(avatarID);
            if (sp == null)
            {
                sp = scene.GetSceneObjectPart(avatarID);
                if (sp == null)
                    return;
                sp = ((ISceneChildEntity) sp).ParentEntity;
            }
            if (!CheckPermission(sp, userAttempting))
                return;

            RemoveAllTagsFromBot(avatarID, userAttempting);

            if (!m_bots.Remove(avatarID))
                return;

            //Kill the agent
            IEntityTransferModule module = scene.RequestModuleInterface<IEntityTransferModule>();
            module.IncomingCloseAgent(scene, avatarID);

            // clean up leftovers...
            var avService = scene.AvatarService;
            avService.ResetAvatar (avatarID);

            var rootFolder = scene.InventoryService.GetRootFolder(avatarID);
            if (rootFolder != null)
                scene.InventoryService.ForcePurgeFolder (rootFolder);

            MainConsole.Instance.InfoFormat("[BotManager]: Removed bot {0} from region {1}",
                sp.Name, scene.RegionInfo.RegionName);
        }
开发者ID:CaseyraeStarfinder,项目名称:WhiteCore-Dev,代码行数:33,代码来源:BotManager.cs


注:本文中的IScene.GetSceneObjectPart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。