public static void PutVector3(this RawMessage message, string key, Vector3 value) { float[] floats = new float[] { value.x, value.y, value.z }; var byteArray = new byte[floats.Length * 4]; Buffer.BlockCopy(floats, 0, byteArray, 0, byteArray.Length); message.putByteArray(key, byteArray); }
public static void PutVector3Array(this RawMessage message, string key, Vector3[] values) { float[] floats = new float[values.Length * 3]; for (int i = 0; i < values.Length; i++) { floats[i * 3] = values[i].x; floats[i * 3 + 1] = values[i].y; floats[i * 3 + 2] = values[i].z; } var byteArray = new byte[floats.Length * 4]; Buffer.BlockCopy(floats, 0, byteArray, 0, byteArray.Length); message.putByteArray(key, byteArray); }