Пример #1
0
        public virtual void ProcessObjectGrabUpdate(
            UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List <SurfaceTouchEventArgs> surfaceArgs)
        {
            SceneObjectPart part = GetSceneObjectPart(objectID);

            if (part == null)
            {
                return;
            }

            SceneObjectGroup group = part.ParentGroup;

            if (group == null || group.IsDeleted)
            {
                return;
            }

            if (Permissions.CanMoveObject(group, remoteClient))
            {
                group.GrabMovement(objectID, offset, pos, remoteClient);
            }

            // This is outside the above permissions condition
            // so that if the object is locked the client moving the object
            // get's it's position on the simulator even if it was the same as before
            // This keeps the moving user's client in sync with the rest of the world.
            group.SendGroupTerseUpdate();

            SurfaceTouchEventArgs surfaceArg = null;

            if (surfaceArgs != null && surfaceArgs.Count > 0)
            {
                surfaceArg = surfaceArgs[0];
            }

            Vector3 grabOffset = pos - part.AbsolutePosition;
            // If the touched prim handles touches, deliver it
            uint partLocalId = part.LocalId;

            if ((part.ScriptEvents & scriptEvents.touch) != 0)
            {
                EventManager.TriggerObjectGrabbing(partLocalId, 0, grabOffset, remoteClient, surfaceArg);
                if (!part.PassTouches)
                {
                    return;
                }
            }

            uint rootLocalId = group.RootPart.LocalId;

            // Deliver to the root prim if the touched prim doesn't handle touches
            // or if we're meant to pass on touches anyway.
            if (partLocalId != rootLocalId && (group.RootPart.ScriptEvents & scriptEvents.touch) != 0)
            {
                EventManager.TriggerObjectGrabbing(rootLocalId, partLocalId, grabOffset, remoteClient, surfaceArg);
            }
        }
Пример #2
0
        /// <summary>
        /// Spin the given object
        /// </summary>
        /// <param name="objectID"></param>
        /// <param name="rotation"></param>
        /// <param name="remoteClient"></param>
        public virtual void ProcessSpinObject(UUID objectID, Quaternion rotation, IClientAPI remoteClient)
        {
            SceneObjectGroup group = GetGroupByPrim(objectID);

            if (group != null)
            {
                if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.)
                {
                    group.SpinMovement(rotation, remoteClient);
                }
                // This is outside the above permissions condition
                // so that if the object is locked the client moving the object
                // get's it's position on the simulator even if it was the same as before
                // This keeps the moving user's client in sync with the rest of the world.
                group.SendGroupTerseUpdate();
            }
        }