Recent Posts
None | 4 sec ago
Java | 10 sec ago
None | 30 sec ago
C | 46 sec ago
None | 54 sec ago
None | 56 sec ago
C# | 1 min ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Natural on the 9th of Feb 2010 09:30:54 PM Download | Raw | Embed | Report
  1.         private void button1_Click(object sender, System.EventArgs e)
  2.         {
  3.             Selectbeam(_zyngoData.PointAtTargetId);
  4.             _client.Self.Touch(_zyngoData.LocalId);
  5.             Unselectbeam();
  6.         }
  7.  
  8. using System;
  9. using OpenMetaverse;
  10.  
  11.  
  12. namespace ZyngoClass
  13. {
  14.     public partial class ZyngoClass
  15.     {
  16.         UUID _beamkey = UUID.Zero;    // zero then unused
  17.         UUID _pointkey = UUID.Zero;   // else filt wit random uniek number( inuse).
  18.         #region bug fix color.
  19.  
  20.         private void BeamEffect(UUID sourceAvatar,
  21.                                UUID targetObject,
  22.                                Vector3d globalOffset,
  23.                                Color4 color,
  24.                                float duration,
  25.                                UUID effectId)
  26.         {
  27.             //OpenMetaverse.Packets.ViewerEffectPacket effect = new OpenMetaverse.Packets.ViewerEffectPacket();
  28.             var effect = new OpenMetaverse.Packets.ViewerEffectPacket
  29.                              {
  30.                                  AgentData =
  31.                                      {
  32.                                          AgentID = _client.Self.AgentID,
  33.                                          SessionID = _client.Self.SessionID
  34.                                      },
  35.                                  Effect = new OpenMetaverse.Packets.ViewerEffectPacket.EffectBlock[1]
  36.                              };
  37.  
  38.             effect.Effect[0] = new OpenMetaverse.Packets.ViewerEffectPacket.EffectBlock
  39.                                    {
  40.                                        AgentID = _client.Self.AgentID,
  41.                                        Color = color.GetBytes(),
  42.                                        Duration = duration,
  43.                                        ID = effectId,
  44.                                        Type = (byte) EffectType.Beam
  45.                                    };
  46.  
  47.             var typeData = new byte[56];
  48.             Buffer.BlockCopy(sourceAvatar.GetBytes(), 0, typeData, 0, 16);
  49.             Buffer.BlockCopy(targetObject.GetBytes(), 0, typeData, 16, 16);
  50.             Buffer.BlockCopy(globalOffset.GetBytes(), 0, typeData, 32, 24);
  51.  
  52.             effect.Effect[0].TypeData = typeData;
  53.  
  54.             _client.Network.SendPacket(effect);
  55.         }
  56.         #endregion
  57.  
  58.         void Selectbeam(UUID objectuuid)
  59.         {
  60.             // restore animation in case of busy ?
  61.             // 09-02-2010
  62.             if (_client.Self.SignaledAnimations.ContainsKey(Animations.BUSY))
  63.                 _client.Self.AnimationStop(Animations.BUSY, true);
  64.            
  65.  
  66.             Unselectbeam();
  67.             //logstatus("Selecting object with beam.");
  68.             while (UUID.Zero == (_beamkey = UUID.Random())) { };// new code !!
  69.             while (UUID.Zero == (_pointkey = UUID.Random())) { };// new code !!
  70.  
  71.             //LogText ("debug start point : "+_beamkey.ToString()+ " // "+ _pointkey.ToString(),Color.Yellow);
  72.             BeamEffect(_client.Self.AgentID,
  73.                         objectuuid,
  74.                         Vector3d.Zero,
  75.                         new Color4(1f, 1f, 1f, 1f),
  76.                         1f,  // 1 seconden !!!!
  77.                         _beamkey);
  78.  
  79.             _client.Self.PointAtEffect(_client.Self.AgentID,
  80.                                       objectuuid,
  81.                                       Vector3d.Zero,
  82.                                       PointAtType.Select,
  83.                                       _pointkey);
  84.         }
  85.  
  86.         private void Unselectbeam()
  87.         {
  88.             if (_beamkey != UUID.Zero)
  89.             {
  90.                 //LogText("debug : stop beam", Color.White);
  91.                 BeamEffect(_client.Self.AgentID,
  92.                             UUID.Zero,
  93.                             Vector3d.Zero,
  94.                             _client.Settings.DEFAULT_EFFECT_COLOR,
  95.                             //new Color4(1f, 1f, 1f, 1f),
  96.                             0f,
  97.                             _beamkey);
  98.                 // 09-02-2010 2x?
  99.                
  100.                 BeamEffect(_client.Self.AgentID,
  101.                             UUID.Zero,
  102.                             Vector3d.Zero,
  103.                             new Color4(0f, 0f, 0f, 0f),
  104.                             0f,
  105.                             _beamkey);
  106.                
  107.                 _beamkey = UUID.Zero;// clear
  108.             }
  109.  
  110.             if (_pointkey == UUID.Zero) return;
  111.             //LogText("debug : stop point", Color.White);
  112.             _client.Self.PointAtEffect(_client.Self.AgentID,
  113.                                        UUID.Zero,
  114.                                        Vector3d.Zero,
  115.                                        PointAtType.None,
  116.                                        _pointkey);
  117.  
  118.             _client.Self.PointAtEffect(_client.Self.AgentID,
  119.                                        UUID.Zero,
  120.                                        Vector3d.Zero,
  121.                                        PointAtType.None,
  122.                                        _pointkey);
  123.             _pointkey = UUID.Zero; // clear
  124.         }
  125.     }
  126. }
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: