Provides primitive data containing updated location, velocity, rotation, textures for the ObjectManager.TerseObjectUpdate event

The ObjectManager.TerseObjectUpdate event occurs when the simulator sends updated location, velocity, rotation, etc

Inheritance: System.EventArgs
Exemplo n.º 1
0
 void Objects_TerseObjectUpdate(object sender, TerseObjectUpdateEventArgs e)
 {
     if (e.Prim.LocalID == Self.LocalID)
     {
         SetDefaultCamera();
     }
 }
Exemplo n.º 2
0
 void Objects_TerseObjectUpdate(object sender, TerseObjectUpdateEventArgs e)
 {
     if (Prims.ContainsKey(e.Prim.LocalID))
     {
         UpdatePrimBlocking(e.Prim);
     }
 }
Exemplo n.º 3
0
        void Objects_TerseObjectUpdate(object sender, TerseObjectUpdateEventArgs e)
        {
            if (!this.IsHandleCreated) return;

            if (Prims.ContainsKey(e.Prim.LocalID))
            {
                UpdatePrimBlocking(e.Prim);
            }
        }
Exemplo n.º 4
0
        void Objects_TerseObjectUpdate(object sender, TerseObjectUpdateEventArgs e)
        {
            if (e.Simulator.Handle != Client.Network.CurrentSim.Handle) return;

            if(e.Prim.ID == Client.Self.AgentID)
                UpdateCameraClientMovement (e.Update.Position);//Update our camera with the new pos (if nessessary)
            //If it is an avatar, we don't need to deal with the terse update stuff, unless it sends textures to us
            if(e.Prim.PrimData.PCode == PCode.Avatar && e.Update.Textures == null)
                return;
            UpdatePrimBlocking(e.Prim);
        }
Exemplo n.º 5
0
        // Seperate thread
        private void Objects_OnObjectUpdated(object sender, TerseObjectUpdateEventArgs e)
        {
            if (!e.Update.Avatar) return;

            try
            {
                BeginInvoke(new MethodInvoker(RefreshStatusBar));
            }
            catch { ; }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Event Handler for waypoint distance checking
 /// </summary>
 private void Objects_TerseObjectUpdate(object sender, TerseObjectUpdateEventArgs e)
 {
     if (status == AutoPilotStatus.Moving && e.Update.Avatar && e.Update.LocalID == Client.Self.LocalID)
     {
         uint regionX, regionY;
         Utils.LongToUInts(e.Simulator.Handle, out regionX, out regionY);
         myGlobalPosition = new Vector3d(
             regionX + e.Update.Position.X,
             regionY + e.Update.Position.Y,
             e.Update.Position.Z
         );
         if (Vector3d.Distance(myGlobalPosition, NextWaypoint) <= waypointRadius)
         {
             if (NextWaypointIsFinal && !Loop)
             {
                 Stop(AutoPilotStatus.Finished);
             }
             else
             {
                 if (OnWaypointArrival != null)
                 {
                     OnWaypointArrival(NextWaypoint);
                 }
                 MoveToNextWaypoint();
             }
         }
     }
 }
Exemplo n.º 7
0
        void Objects_TerseObjectUpdate(object sender, TerseObjectUpdateEventArgs e)
        {
            if (!e.Update.Avatar) return;
            if (!following) return;

            Avatar av;
            client.Network.CurrentSim.ObjectsAvatars.TryGetValue(e.Update.LocalID, out av);
            if (av == null) return;

            if (av.Name == followName)
            {
                Vector3 pos = AvatarPosition(client.Network.CurrentSim, av);

                FollowUpdate(pos);
            }
        }
Exemplo n.º 8
0
        void Objects_TerseObjectUpdate(object sender, TerseObjectUpdateEventArgs e)
        {
            if (e.Simulator.Handle != Client.Network.CurrentSim.Handle) return;
            if (e.Prim.ID == Client.Self.AgentID)
            {
                trackedObject = myself;
            }

            //If it is an avatar, we don't need to deal with the terse update stuff, unless it sends textures to us
            if (e.Prim.PrimData.PCode == PCode.Avatar && e.Update.Textures == null)
                return;

            UpdatePrimBlocking(e.Prim);
        }
Exemplo n.º 9
0
        private void Objects_OnObjectUpdated(object s , TerseObjectUpdateEventArgs e)
        {
            var Client = GetGridClient();
            var ClientMovement = Client.Self.Movement;

            if (startTime == DateTime.MinValue)
            {
                DeRegCallback();
                return;
            }
            if (e.Update.LocalID == Client.Self.LocalID)
            {
                XYMovement();
                ZMovement();
                if (ClientMovement.AtPos || ClientMovement.AtNeg)
                {
                    TheBot.TurnToward(Target.GlobalPosition);
                    //Debug("Flyxy ");
                }
                else if (ClientMovement.UpPos || ClientMovement.UpNeg)
                {
                    TheBot.TurnToward(Target.GlobalPosition);
                    //ClientMovement.SendUpdate(false);
                    //Debug("Fly z ");
                }
                else if (Vector3d.Distance(Target.GlobalPosition, TheBot.GlobalPosition) <= 2.0)
                {
                    EndFlyto();
                    KeepFollowing = false;
                    Debug("At Target");
                }
            }
            if (!KeepFollowing)
            {
                EndFlyto();
                Debug("End Flyto");
            }
        }
Exemplo n.º 10
0
        public void OnTerseObjectUpdate(object sender, TerseObjectUpdateEventArgs e)
        {
            ObjectMovementUpdate omu = e.Update;
            Avatar avatar;

            m_GridClient.Network.CurrentSim.ObjectsAvatars.TryGetValue(e.Update.LocalID, out avatar);

            if (avatar != null && avatar.Name != "")
            {
                if (avatar.Name == CONDUCTOR)
                {
                    m_ir.UpdateState(m_GridClient.Self.RelativePosition, avatar.Position);
                    Debug.WriteLine("UUID = " + avatar.ID);

                    if (Vector3.Distance(m_GridClient.Self.RelativePosition, avatar.Position) < 5)
                        Debug.WriteLine("collision happened between player and " + m_GridClient.Self.Name);
                }

                // follow avatar
                FollowAvatar(avatar);
            }
        }
Exemplo n.º 11
0
 public virtual void Objects_OnObjectUpdated(object sender, TerseObjectUpdateEventArgs e) { OnEvent("On-Object-Updated", paramNamesOnObjectUpdated, paramTypesOnObjectUpdated, e); }
Exemplo n.º 12
0
 public override void Objects_OnObjectUpdated(object sender, TerseObjectUpdateEventArgs e1)
 {
     Objects_OnPrimitiveUpdateReal(e1.Simulator, e1.Prim, e1.Update, e1.Simulator.Handle, e1.TimeDilation);
     //base.Objects_OnObjectUpdated(sender,e1);
 }
Exemplo n.º 13
0
        ////Separate thread
        //private void Objects_OnObjectKilled(object sender, KillObjectEventArgs e)
        //{
        //    if (InvokeRequired)
        //    {
        //        BeginInvoke(new MethodInvoker(delegate()
        //        {
        //            Objects_OnObjectKilled(sender, e);
        //        }));
        //        return;
        //    }
        //    if (e.Simulator != client.Network.CurrentSim) return;
        //    if (sfavatar == null) return;
        //    if (!sfavatar.ContainsKey(e.ObjectLocalID)) return;
        //    foreach (ListViewItem litem in lvwRadar.Items)
        //    {
        //        if (litem.Tag.ToString() == sfavatar[e.ObjectLocalID].ID.ToString())
        //        {
        //            lvwRadar.BeginUpdate();
        //            lvwRadar.Items.RemoveByKey(sfavatar[e.ObjectLocalID].Name);
        //            lvwRadar.EndUpdate();
        //        }
        //    }
        //    try
        //    {
        //        lock (sfavatar)
        //        {
        //            sfavatar.Remove(e.ObjectLocalID);
        //        }
        //    }
        //    catch { ; }
        //}
        ////Separate thread
        //private void Objects_OnNewAvatar(object sender, AvatarUpdateEventArgs e)
        //{
        //    if (InvokeRequired)
        //    {
        //        BeginInvoke(new MethodInvoker(delegate()
        //        {
        //            Objects_OnNewAvatar(sender, e);
        //        }));
        //        return;
        //    }
        //    if (e.Simulator != client.Network.CurrentSim) return;
        //    if (sfavatar.ContainsKey(e.Avatar.LocalID)) return;
        //    try
        //    {
        //        lock (sfavatar)
        //        {
        //            sfavatar.Add(e.Avatar.LocalID, e.Avatar);
        //        }
        //    }
        //    catch { ; }
        //}
        private void Objects_OnObjectUpdated(object sender, TerseObjectUpdateEventArgs e)
        {
            if (e.Simulator != client.Network.CurrentSim) return;
            if (!e.Update.Avatar) return;

            if (!netcom.IsLoggedIn) return;

            //Avatar av = new Avatar();
            //client.Network.CurrentSim.ObjectsAvatars.TryGetValue(e.Update.LocalID, out av);
            ////client.Network.CurrentSim.ObjectsAvatars.TryGetValue(e.Prim.LocalID, out av);

            //if (av == null) return;

            //if (!sfavatar.ContainsKey(av.LocalID))
            //{
            //    //Avatar av = new Avatar();
            //    //client.Network.CurrentSim.ObjectsAvatars.TryGetValue(e.Update.LocalID, out av);

            //    try
            //    {
            //        lock (sfavatar)
            //        {
            //            sfavatar.Add(av.LocalID, av);
            //        }
            //    }
            //    catch { ; }
            //}
            //else
            //{
            //    lock (sfavatar)
            //    {
            //        sfavatar.Remove(av.LocalID);
            //        sfavatar.Add(av.LocalID, av);
            //    }
            //}

            if (e.Prim.ID == client.Self.AgentID)
            {
                instance.State.ResetCamera();

                BeginInvoke(new MethodInvoker(delegate()
                {
                    try
                    {
                        if (!lvwRadar.Items.ContainsKey(client.Self.Name))
                        {
                            ListViewItem item = lvwRadar.Items.Add(client.Self.Name, client.Self.Name, string.Empty);
                            item.Font = new Font(item.Font, FontStyle.Bold);
                            item.Tag = client.Self.AgentID;
                            item.BackColor = Color.WhiteSmoke;
                            item.ForeColor = Color.Black;

                            item.SubItems.Add(string.Empty);
                            //item.SubItems.Add(string.Empty);
                        }
                    }
                    catch { ; }
                }));

                return;
            }
        }
Exemplo n.º 14
0
 void Objects_TerseObjectUpdate(object sender, TerseObjectUpdateEventArgs e)
 {
     if (e.Update.Avatar && e.Update.LocalID == Client.Self.LocalID) {
         mypos = e.Update.Position;
         if (Vector3.Distance(mypos, Waypoints[NextWaypoint]) < 2f) {
             NextWaypoint++;
         }
     }
 }
Exemplo n.º 15
0
        void Objects_OnObjectUpdated(object sender, TerseObjectUpdateEventArgs e)
        {
            bool found;
            lock (_TrackedAvatars)
                found = _TrackedAvatars.ContainsKey(e.Update.LocalID);

            if (found)
            {
                Avatar av;
                if (e.Simulator.ObjectsAvatars.TryGetValue(e.Update.LocalID, out av))
                    UpdateAvatar(av);
            }
        }
Exemplo n.º 16
0
        void Objects_TerseObjectUpdate(object sender, TerseObjectUpdateEventArgs e)
        {
            if (!e.Update.Avatar) return;

            if (e.Prim.LocalID == client.Self.LocalID)
            {
                SetDefaultCamera();
            }

            if (!following) return;

            Avatar av;
            client.Network.CurrentSim.ObjectsAvatars.TryGetValue(e.Update.LocalID, out av);
            if (av == null) return;

            if (av.ID == followID)
            {
                Vector3 pos = AvatarPosition(client.Network.CurrentSim, av);

                FollowUpdate(pos);
            }
        }
Exemplo n.º 17
0
 private void Objects_OnObjectUpdated(object s, TerseObjectUpdateEventArgs e)
 {
     if (startTime == DateTime.MinValue) return;
     if (e.Update.LocalID == Client.Self.LocalID)
     {
         XYMovement();
         ZMovement();
         if (Client.Self.Movement.AtPos || Client.Self.Movement.AtNeg)
         {
             Client.Self.Movement.TurnToward(target);
             Debug("Flyxy ");
         }
         else if (Client.Self.Movement.UpPos || Client.Self.Movement.UpNeg)
         {
             Client.Self.Movement.TurnToward(target);
             //Client.Self.Movement.SendUpdate(false);
             Debug("Fly z ");
         }
         else if (Vector3.Distance(target, GetSimPosition()) <= 2.0)
         {
             EndFlyto();
             Debug("At Target");
         }
     }
     if (DateTime.Now.Subtract(startTime).TotalMilliseconds > duration)
     {
         EndFlyto();
         Debug("End Flyto");
     }
 }
Exemplo n.º 18
0
 ///<summary>Raises the TerseObjectUpdate Event</summary>
 /// <param name="e">A TerseObjectUpdateEventArgs object containing
 /// the data sent from the simulator</param>
 protected virtual void OnTerseObjectUpdate(TerseObjectUpdateEventArgs e)
 {
     EventHandler<TerseObjectUpdateEventArgs> handler = m_TerseObjectUpdate;
     if (handler != null)
         handler(this, e);
 }
Exemplo n.º 19
0
        private void Objects_OnObjectUpdated(object sender, TerseObjectUpdateEventArgs e)
        {
            if (!e.Update.Avatar) return;

            //if (e.Prim.LocalID == client.Self.LocalID) ResetCamera();

            //if (!following && !goingto) return;
            if (!following) return;

            Avatar av = new Avatar();
            client.Network.CurrentSim.ObjectsAvatars.TryGetValue(e.Update.LocalID, out av);

            if (av == null)
            {
                client.Self.AutoPilotCancel();
                Logger.Log("Follow/GoTo cancelled. Could not find the target avatar on the SIM.", Helpers.LogLevel.Warning);
                return;
            }

            if (av.Name != followName) return;

            Vector3 pos = new Vector3(Vector3.Zero); ;

            pos = av.Position;

            if (av.ParentID != 0)
            {
                uint oID = av.ParentID;

                if (prim == null)
                {
                    client.Network.CurrentSim.ObjectsPrimitives.TryGetValue(oID, out prim);
                }

                if (prim == null)
                {
                    client.Self.AutoPilotCancel();
                    Logger.Log("Follow/GoTo cancelled. Could not find the object the target avatar is sitting on.", Helpers.LogLevel.Warning);
                    return;
                }

                pos += prim.Position;
            }
            else
            {
                prim = null;
            }

            client.Self.Movement.TurnToward(pos);

            float dist = Vector3.Distance(instance.SIMsittingPos(), pos);

            //if (av.Name == goName)
            //{
            //    if (goingto)
            //    {
            //        if (dist < 3.0f)
            //        {
            //            client.Self.AutoPilotCancel();
            //            client.Self.Movement.TurnToward(pos);

            //            goid = UUID.Zero;
            //            goName = string.Empty;
            //            goingto = false;
            //        }
            //        else
            //        {
            //            client.Self.AutoPilotCancel();
            //            ulong followRegionX = e.Simulator.Handle >> 32;
            //            ulong followRegionY = e.Simulator.Handle & (ulong)0xFFFFFFFF;
            //            ulong xTarget = (ulong)pos.X + followRegionX;
            //            ulong yTarget = (ulong)pos.Y + followRegionY;
            //            float zTarget = pos.Z - 1f;

            //            client.Self.AutoPilot(xTarget, yTarget, zTarget);
            //        }
            //    }

            //    return;
            //}

            //if (av.Name == followName)
            //{
            client.Self.Movement.TurnToward(av.Position);

            if (dist > followDistance)
            {
                client.Self.AutoPilotCancel();
                ulong followRegionX = e.Simulator.Handle >> 32;
                ulong followRegionY = e.Simulator.Handle & (ulong)0xFFFFFFFF;
                ulong xTarget = (ulong)pos.X + followRegionX;
                ulong yTarget = (ulong)pos.Y + followRegionY;
                float zTarget = pos.Z - 1f;

                client.Self.AutoPilot(xTarget, yTarget, zTarget);
            }
            //}
        }