Пример #1
0
    void Unpack(byte[] data, Transform outTransform)
    {
        var union32 = new MessageEncoder.Union32();
        var pos = Vector3.zero;
        var scl = Vector3.zero;
        var rot = Quaternion.identity;

        for (var i = 0; i < 3; i++) {
            union32.Unpack(data, i * 4);
            pos[i] = union32.floatdata;
        }
        for (var i = 0; i < 3; i++) {
            union32.Unpack(data, 12 + i * 4);
            scl[i] = union32.floatdata;
        }
        for (var i = 0; i < 4; i++) {
            union32.Unpack(data, 24 + i * 4);
            rot[i] = union32.floatdata;
        }
        outTransform.localPosition = pos;
        outTransform.localScale = scl;
        outTransform.localRotation = rot;
    }
Пример #2
0
 float ReadFloat32()
 {
     var union32 = new MessageEncoder.Union32();
     union32.Unpack(readBuffer, readPoint);
     readPoint += 4;
     return union32.floatdata;
 }