예제 #1
0
        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);
        }
예제 #2
0
 public DetectParams()
 {
     Key = UUID.Zero;
     OffsetPos = new LSL_Types.Vector3();
     LinkNum = 0;
     Group = UUID.Zero;
     Name = String.Empty;
     Owner = UUID.Zero;
     Position = new LSL_Types.Vector3();
     Rotation = new LSL_Types.Quaternion();
     Type = 0;
     Velocity = new LSL_Types.Vector3();
     initializeSurfaceTouch();
 }