public override byte[] Serialize(bool partofsomethingelse)
        {
            int  currentIndex = 0, length = 0;
            bool hasmetacomponents = false;

            byte[]        thischunk, scratch1, scratch2;
            List <byte[]> pieces = new List <byte[]>();
            GCHandle      h;

            //header
            if (header == null)
            {
                header = new Header();
            }
            pieces.Add(header.Serialize(true));
            //wrench
            if (wrench == null)
            {
                wrench = new Wrench();
            }
            pieces.Add(wrench.Serialize(true));
            //combine every array in pieces into one array and return it
            int __a_b__f = pieces.Sum((__a_b__c) => __a_b__c.Length);
            int __a_b__e = 0;

            byte[] __a_b__d = new byte[__a_b__f];
            foreach (var __p__ in pieces)
            {
                Array.Copy(__p__, 0, __a_b__d, __a_b__e, __p__.Length);
                __a_b__e += __p__.Length;
            }
            return(__a_b__d);
        }
        public static Wrench operator+(Wrench lhs, Wrench rhs)
        {
            Wrench w = new Wrench();

            w.force  = lhs.force + rhs.force;
            w.torque = lhs.torque + rhs.torque;
            return(w);
        }
        public override void Deserialize(byte[] SERIALIZEDSTUFF, ref int currentIndex)
        {
            int    arraylength       = -1;
            bool   hasmetacomponents = false;
            object __thing;
            int    piecesize = 0;

            byte[] thischunk, scratch1, scratch2;
            IntPtr h;

            //header
            header = new Header(SERIALIZEDSTUFF, ref currentIndex);
            //wrench
            wrench = new Wrench(SERIALIZEDSTUFF, ref currentIndex);
        }
        public override void Randomize()
        {
            int    arraylength = -1;
            Random rand        = new Random();
            int    strlength;

            byte[] strbuf, myByte;

            //header
            header = new Header();
            header.Randomize();
            //wrench
            wrench = new Wrench();
            wrench.Randomize();
        }
    void WrenchCallback(Wrench msg)
    {
        if (inputCtrl.localInput)
        {
            return;
        }

        Vector3 force  = msg.force.ToUnityVector();
        Vector3 torque = msg.torque.ToUnityVector();

        if (droneController != null)
        {
            if (!droneController.MotorsEnabled)
            {
                droneController.MotorsEnabled = true;
            }
            droneController.ApplyMotorForce(force, true);
            droneController.ApplyMotorTorque(torque, true);
        }
    }