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


C# LLVector3.GetBytes方法代码示例

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


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

示例1: SetPosition

        /// <summary>
        /// Change the position of an object
        /// </summary>
        /// <param name="simulator">A reference to the <seealso cref="libsecondlife.Simulator"/> object where the object resides</param>
        /// <param name="localID">The objects ID which is local to the simulator the object is in</param>
        /// <param name="position">The new position of the object</param>
        public void SetPosition(Simulator simulator, uint localID, LLVector3 position)
        {
            MultipleObjectUpdatePacket multiObjectUpdate = new MultipleObjectUpdatePacket();
            multiObjectUpdate.AgentData.AgentID = Client.Self.AgentID;
            multiObjectUpdate.AgentData.SessionID = Client.Self.SessionID;

            multiObjectUpdate.ObjectData = new MultipleObjectUpdatePacket.ObjectDataBlock[1];

            multiObjectUpdate.ObjectData[0] = new MultipleObjectUpdatePacket.ObjectDataBlock();
            multiObjectUpdate.ObjectData[0].Type = 9;
            multiObjectUpdate.ObjectData[0].ObjectLocalID = localID;
            multiObjectUpdate.ObjectData[0].Data = position.GetBytes();

            Client.Network.SendPacket(multiObjectUpdate, simulator);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:21,代码来源:ObjectManager.cs

示例2: SetupTemplate

        public static void SetupTemplate(string name)
        {
            FileInfo fInfo = new FileInfo(name);
            long numBytes = fInfo.Length;
            FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
            BinaryReader br = new BinaryReader(fStream);
            byte[] data1 = br.ReadBytes((int)numBytes);
            br.Close();
            fStream.Close();

            libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); //  new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);

            SetDefaultPacketValues(objdata);
            objdata.TextureEntry = data1;
            objdata.UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24);
            objdata.PathCurve = 16;
            objdata.ProfileCurve = 1;
            objdata.PathScaleX = 100;
            objdata.PathScaleY = 100;
            objdata.ParentID = 0;
            objdata.OwnerID = LLUUID.Zero;
            objdata.Scale = new LLVector3(1, 1, 1);
            objdata.PCode = 47;
            System.Text.Encoding enc = System.Text.Encoding.ASCII;
            libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16);
            pos.X = 100f;
            objdata.ID = 8880000;
            objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0");
            libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100f, 23f);
            //objdata.FullID=user.AgentID;
            byte[] pb = pos.GetBytes();
            Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);

            Avatar.AvatarTemplate = objdata;
        }
开发者ID:BackupTheBerlios,项目名称:ulife-svn,代码行数:35,代码来源:Avatar.cs

示例3: cmdImport_Click


//.........这里部分代码省略.........
                        break;
                    case 1:
                        // Cylinder
                        prim.ProfileCurve = 0;
                        prim.PathCurve = 16;
                        break;
                    case 2:
                        // Prism
                        prim.ProfileCurve = 3;
                        prim.PathCurve = 16;
                        break;
                    case 3:
                        // Sphere
                        prim.ProfileCurve = 5;
                        prim.PathCurve = 32;
                        break;
                    case 4:
                        // Torus
                        prim.ProfileCurve = 0;
                        prim.PathCurve = 32;
                        break;
                    case 5:
                        // Tube
                        prim.ProfileCurve = 1;
                        prim.PathCurve = 32;
                        break;
                    case 6:
                        // Ring
                        prim.ProfileCurve = 3;
                        prim.PathCurve = 16;
                        break;
                }
                prim.ProfileHollow = Convert.ToUInt32(properties["hollow"].Attributes["val"].Value);
                prim.Rotation = new LLQuaternion(
                    Convert.ToSingle(properties["rotation"].Attributes["x"].Value),
                    Convert.ToSingle(properties["rotation"].Attributes["y"].Value),
                    Convert.ToSingle(properties["rotation"].Attributes["z"].Value),
                    Convert.ToSingle(properties["rotation"].Attributes["s"].Value));
                prim.Scale = new LLVector3(
                    Convert.ToSingle(properties["size"].Attributes["x"].Value),
                    Convert.ToSingle(properties["size"].Attributes["y"].Value),
                    Convert.ToSingle(properties["size"].Attributes["z"].Value));

                LLVector3 position = new LLVector3(
                    Convert.ToSingle(properties["position"].Attributes["x"].Value) + (float)Client.Avatar.Position.X,
                    Convert.ToSingle(properties["position"].Attributes["y"].Value) + (float)Client.Avatar.Position.Y,
                    Convert.ToSingle(properties["position"].Attributes["z"].Value) + (float)Client.Avatar.Position.Z + 50.0F);
                prim.Position = position;

                CurrentPrim = prim;
                WaitingOnUpdate = true;

                Client.CurrentRegion.RezObject(prim, position, new LLVector3(Client.Avatar.Position));

                while (WaitingOnUpdate)
                {
                    System.Threading.Thread.Sleep(100);
                    Application.DoEvents();
                }

                txtLog.AppendText("Rezzed primitive with UUID " + CurrentPrim.UUID + " and ID " + CurrentPrim.ID + " \n");

                Hashtable blocks = new Hashtable();
                Hashtable fields = new Hashtable();

                /*fields["ObjectLocalID"] = CurrentPrim.ID;
                blocks[fields] = "ObjectData";

                fields = new Hashtable();

                fields["AgentID"] = Client.Network.AgentID;
                blocks[fields] = "AgentData";

                Packet packet = PacketBuilder.BuildPacket("ObjectSelect", Client.Protocol, blocks, Helpers.MSG_RELIABLE);
                Client.Network.SendPacket(packet);

                System.Threading.Thread.Sleep(100);*/
                Packet packet;

                byte[] byteArray = new byte[12];
                Array.Copy(position.GetBytes(), byteArray, 12);

                fields["Data"] = byteArray;
                fields["Type"] = (byte)9;
                fields["ObjectLocalID"] = CurrentPrim.ID;
                blocks[fields] = "ObjectData";

                fields = new Hashtable();

                fields["AgentID"] = Client.Network.AgentID;
                blocks[fields] = "AgentData";

                packet = PacketBuilder.BuildPacket("MultipleObjectUpdate", Client.Protocol, blocks, Helpers.MSG_RELIABLE);
                Client.Network.SendPacket(packet);
                Client.Network.SendPacket(packet);
                Client.Network.SendPacket(packet);

                System.Threading.Thread.Sleep(500);
            }
        }
开发者ID:BackupTheBerlios,项目名称:libsecondlife-svn,代码行数:101,代码来源:frmPrimImporter.cs

示例4: SetupTemplate

        //test only
        private void SetupTemplate(string name)
        {
            //should be replaced with completely code generated packets
            int i = 0;
            FileInfo fInfo = new FileInfo(name);
            long numBytes = fInfo.Length;
            FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
            BinaryReader br = new BinaryReader(fStream);
            byte [] data1 = br.ReadBytes((int)numBytes);
            br.Close();
            fStream.Close();

            libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);

            System.Text.Encoding enc = System.Text.Encoding.ASCII;
            libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16);
            pos.X = 100f;
            objdata.ID = 8880000;
            objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0");
            libsecondlife.LLVector3 pos2 = new LLVector3(13.981f,100.0f,20.0f);
            //objdata.FullID=user.AgentID;
            byte[] pb = pos.GetBytes();
            Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);

            _avatarTemplate = objdata;
        }
开发者ID:BackupTheBerlios,项目名称:ulife-svn,代码行数:27,代码来源:SceneGraph.cs

示例5: UpdateObject

        /// <summary>
        /// Send a Multiple Object Update packet to change the size, scale or rotation of a primitive
        /// </summary>
        /// <param name="simulator">A reference to the <seealso cref="libsecondlife.Simulator"/> object where the object resides</param>
        /// <param name="localID">The objects ID which is local to the simulator the object is in</param>
        /// <param name="data">The new rotation, size, or position of the target object</param>
        /// <param name="type">The flags from the <seealso cref="UpdateType"/> Enum</param>
        public void UpdateObject(Simulator simulator, uint localID, LLVector3 data, UpdateType type)
        {
            MultipleObjectUpdatePacket multiObjectUpdate = new MultipleObjectUpdatePacket();
            multiObjectUpdate.AgentData.AgentID = Client.Self.AgentID;
            multiObjectUpdate.AgentData.SessionID = Client.Self.SessionID;

            multiObjectUpdate.ObjectData = new MultipleObjectUpdatePacket.ObjectDataBlock[1];

            multiObjectUpdate.ObjectData[0] = new MultipleObjectUpdatePacket.ObjectDataBlock();
            multiObjectUpdate.ObjectData[0].Type = (byte)type;
            multiObjectUpdate.ObjectData[0].ObjectLocalID = localID;
            multiObjectUpdate.ObjectData[0].Data = data.GetBytes();

            Client.Network.SendPacket(multiObjectUpdate, simulator);
        }
开发者ID:chrbayer84,项目名称:SLAgentCSServer,代码行数:22,代码来源:ObjectManager.cs

示例6: SendAvatarDataToAll

        private void SendAvatarDataToAll(AvatarData avatar)
        {
            ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
            objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle;
            objupdate.RegionData.TimeDilation = 0;
            objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];

            objupdate.ObjectData[0] = _avatarTemplate;
            objupdate.ObjectData[0].ID = avatar.LocalID;
            objupdate.ObjectData[0].FullID = avatar.NetInfo.User.AgentID;
            objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + avatar.NetInfo.User.FirstName + "\nLastName STRING RW SV " + avatar.NetInfo.User.LastName + " \0");

            libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100.0f, 22.0f);
            byte[] pb = pos2.GetBytes();
            Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);

            SendInfo send = new SendInfo();
            send.Incr = true;
            send.NetInfo = avatar.NetInfo;
            send.Packet = objupdate;
            send.SentTo = 1; //to all clients
            this._updateSender.SendList.Enqueue(send);
        }
开发者ID:BackupTheBerlios,项目名称:ulife-svn,代码行数:23,代码来源:SceneGraph.cs

示例7: SendAvatarData

        //test only
        private void SendAvatarData(NetworkInfo userInfo)
        {
            ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
            objupdate.RegionData.RegionHandle = Globals.Instance.RegionHandle;
            objupdate.RegionData.TimeDilation = 64096;
            objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];

            objupdate.ObjectData[0] = _avatarTemplate;
            //give this avatar object a local id and assign the user a name
            objupdate.ObjectData[0].ID = 8880000;// + this._localNumber;
            userInfo.User.AvatarLocalID = objupdate.ObjectData[0].ID;
            //User_info.name="Test"+this.local_numer+" User";
            //this.GetAgent(userInfo.UserAgentID).Started = true;
            objupdate.ObjectData[0].FullID = userInfo.User.AgentID;
            objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + userInfo.User.FirstName + "\nLastName STRING RW SV " + userInfo.User.LastName + " \0");
            //userInfo.User.FullName = "FirstName STRING RW SV " + userInfo.first_name + "\nLastName STRING RW SV " + userInfo.last_name + " \0";

            libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100.0f, 22.0f);
            byte[] pb = pos2.GetBytes();
            Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);

            //this._localNumber++;
            _server.SendPacket(objupdate, true, userInfo);
        }
开发者ID:BackupTheBerlios,项目名称:ulife-svn,代码行数:25,代码来源:SceneGraph.cs

示例8: CreateUpdatePacket

        public ObjectUpdatePacket CreateUpdatePacket()
        {
            System.Text.Encoding _enc = System.Text.Encoding.ASCII;
            //send a objectupdate packet with information about the clients avatar
            ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
            objupdate.RegionData.RegionHandle = m_regionHandle;
            objupdate.RegionData.TimeDilation = 64096;
            objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];

            objupdate.ObjectData[0] = AvatarTemplate;
            //give this avatar object a local id and assign the user a name
            objupdate.ObjectData[0].ID = this.localid;
            objupdate.ObjectData[0].FullID = ControllingClient.AgentID;
            objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0");

            libsecondlife.LLVector3 pos2 = new LLVector3((float)this._physActor.Position.X, (float)this._physActor.Position.Y, (float)this._physActor.Position.Z);

            byte[] pb = pos2.GetBytes();

            Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
            return objupdate;
        }
开发者ID:BackupTheBerlios,项目名称:ulife-svn,代码行数:22,代码来源:AvatarUpdate.cs

示例9: SendInitialPosition

        public void SendInitialPosition()
        {
            System.Text.Encoding _enc = System.Text.Encoding.ASCII;
            //send a objectupdate packet with information about the clients avatar

            ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
            objupdate.RegionData.RegionHandle = m_regionHandle;
            objupdate.RegionData.TimeDilation = 64096;
            objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
            objupdate.ObjectData[0] = AvatarTemplate;
            //give this avatar object a local id and assign the user a name

            objupdate.ObjectData[0].ID = this.localid;
            this.uuid = objupdate.ObjectData[0].FullID = ControllingClient.AgentID;
            objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0");
            libsecondlife.LLVector3 pos2 = new LLVector3((float)this.Pos.X, (float)this.Pos.Y, (float)this.Pos.Z);
            byte[] pb = pos2.GetBytes();
            Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
            m_world._localNumber++;
            foreach (SimClient client in m_clientThreads.Values)
            {
                client.OutPacket(objupdate);
                if (client.AgentID != ControllingClient.AgentID)
                {
                    //the below line is already in Simclient.cs at line number 245 , directly below the call to this method
                    //if there is a problem/bug with that , then lets fix it there rather than duplicating it here
                    //client.ClientAvatar.SendAppearanceToOtherAgent(this.ControllingClient);

                    SendAppearanceToOtherAgent(client);
                }
            }
        }
开发者ID:BackupTheBerlios,项目名称:ulife-svn,代码行数:32,代码来源:AvatarUpdate.cs

示例10: CreateTerseBlock

        public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock()
        {
            byte[] bytes = new byte[60];
            int i = 0;
            ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();

            dat.TextureEntry = new byte[0];// AvatarTemplate.TextureEntry;
            libsecondlife.LLVector3 pos2 = new LLVector3(0, 0, 0);
            lock (m_world.LockPhysicsEngine)
            {
                pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z);
            }

            uint ID = this.localid;

            bytes[i++] = (byte)(ID % 256);
            bytes[i++] = (byte)((ID >> 8) % 256);
            bytes[i++] = (byte)((ID >> 16) % 256);
            bytes[i++] = (byte)((ID >> 24) % 256);
            bytes[i++] = 0;
            bytes[i++] = 1;
            i += 14;
            bytes[i++] = 128;
            bytes[i++] = 63;

            byte[] pb = pos2.GetBytes();
            Array.Copy(pb, 0, bytes, i, pb.Length);
            i += 12;
            ushort InternVelocityX;
            ushort InternVelocityY;
            ushort InternVelocityZ;
            Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(0, 0, 0);
            lock (m_world.LockPhysicsEngine)
            {
                internDirec = new Axiom.MathLib.Vector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z);
            }
            internDirec = internDirec / 128.0f;
            internDirec.x += 1;
            internDirec.y += 1;
            internDirec.z += 1;

            InternVelocityX = (ushort)(32768 * internDirec.x);
            InternVelocityY = (ushort)(32768 * internDirec.y);
            InternVelocityZ = (ushort)(32768 * internDirec.z);

            ushort ac = 32767;
            bytes[i++] = (byte)(InternVelocityX % 256);
            bytes[i++] = (byte)((InternVelocityX >> 8) % 256);
            bytes[i++] = (byte)(InternVelocityY % 256);
            bytes[i++] = (byte)((InternVelocityY >> 8) % 256);
            bytes[i++] = (byte)(InternVelocityZ % 256);
            bytes[i++] = (byte)((InternVelocityZ >> 8) % 256);

            //accel
            bytes[i++] = (byte)(ac % 256);
            bytes[i++] = (byte)((ac >> 8) % 256);
            bytes[i++] = (byte)(ac % 256);
            bytes[i++] = (byte)((ac >> 8) % 256);
            bytes[i++] = (byte)(ac % 256);
            bytes[i++] = (byte)((ac >> 8) % 256);

            //rot
            bytes[i++] = (byte)(ac % 256);
            bytes[i++] = (byte)((ac >> 8) % 256);
            bytes[i++] = (byte)(ac % 256);
            bytes[i++] = (byte)((ac >> 8) % 256);
            bytes[i++] = (byte)(ac % 256);
            bytes[i++] = (byte)((ac >> 8) % 256);
            bytes[i++] = (byte)(ac % 256);
            bytes[i++] = (byte)((ac >> 8) % 256);

            //rotation vel
            bytes[i++] = (byte)(ac % 256);
            bytes[i++] = (byte)((ac >> 8) % 256);
            bytes[i++] = (byte)(ac % 256);
            bytes[i++] = (byte)((ac >> 8) % 256);
            bytes[i++] = (byte)(ac % 256);
            bytes[i++] = (byte)((ac >> 8) % 256);

            dat.Data = bytes;
            return (dat);
        }
开发者ID:BackupTheBerlios,项目名称:ulife-svn,代码行数:82,代码来源:AvatarUpdate.cs


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