Esempio n. 1
0
        public byte[] ClientWritePacket(GameObject go, UInt32 count)
        {
            byte[]   spare0 = new byte[2];
            UInt32[] spare1 = new UInt32[4];

            Vector3 pos_c = Geometry.transform.position;
            Vector3 pos_a = Geometry.transform.eulerAngles;

            HandlePacket.coord pos   = new HandlePacket.coord(pos_c.z, -pos_c.x, pos_c.y, Convert.ToSingle(-pos_a.y * Math.PI / 180f), Convert.ToSingle(pos_a.x * Math.PI / 180f), Convert.ToSingle(pos_a.z * Math.PI / 180f), 0x01 | 0x02, 0, 0); // change it here
            HandlePacket.coord speed = GetMySpeed(go);
            HandlePacket.coord accel = new HandlePacket.coord(0, 0, 0, 0, 0, 0, 0x01, 0, 0);
            HandlePacket.geo   geo   = new HandlePacket.geo(4.6f, 1.86f, 1.6f, 0.8f, 0, 0.3f);

            HandlePacket.wheel_o[] wheel_O = new HandlePacket.wheel_o[4];
            float rotAngle = GetMyRotAngle();

            wheel_O[0] = new HandlePacket.wheel_o(1, 0, 0, spare0, 1, -0.025f, rotAngle / 180 * Mathf.PI, 0, -carController.CurrentSteerAngle / 180 * Mathf.PI, spare1);
            wheel_O[1] = new HandlePacket.wheel_o(1, 1, 0, spare0, 1, -0.025f, rotAngle / 180 * Mathf.PI, 0, -carController.CurrentSteerAngle / 180 * Mathf.PI, spare1);
            wheel_O[2] = new HandlePacket.wheel_o(1, 2, 0, spare0, 1, -0.025f, rotAngle / 180 * Mathf.PI, 0, 0, spare1);
            wheel_O[3] = new HandlePacket.wheel_o(1, 3, 0, spare0, 1, -0.025f, rotAngle / 180 * Mathf.PI, 0, 0, spare1);

            simTime = stopwatch1.Elapsed.TotalSeconds;
            buffer  = HandlePacket.Catch.CatchPacket(simTime, m_Id, geo, pos, speed, accel, count, wheel_O);
            return(buffer);
        }
Esempio n. 2
0
        public byte[] ClientWritePacket(GameObject go, UInt32 count)
        {
            Vector3 pos   = go.transform.position;
            Vector3 speed = new Vector3(0, 0, 0);
            Vector3 accel = new Vector3(0, 0, 0);
            Vector3 geo   = new Vector3(0, 0, 0);

            HandlePacket.coord mypos   = HandlePacket.Catch.CatchCoord(pos);
            HandlePacket.coord myspeed = HandlePacket.Catch.CatchCoord(speed);
            HandlePacket.coord myaccel = HandlePacket.Catch.CatchCoord(accel);
            HandlePacket.geo   mygeo   = HandlePacket.Catch.CatchGeo(geo);
            buffer = HandlePacket.Catch.CatchPacket(mygeo, mypos, myspeed, myaccel, count);
            return(buffer);
        }