public static Vector3 GetVector3(this RawMessage message, string key) { byte[] bytes = message.getByteArray(key); float[] floats = new float[bytes.Length / 4]; Buffer.BlockCopy(bytes, 0, floats, 0, bytes.Length); return(new Vector3(floats[0], floats[1], floats[2])); }
public static Vector3[] GetVector3Array(this RawMessage message, string key) { byte[] bytes = message.getByteArray(key); float[] floats = new float[bytes.Length / 4]; Buffer.BlockCopy(bytes, 0, floats, 0, bytes.Length); Vector3[] result = new Vector3[floats.Length / 3]; for (int i = 0; i < result.Length; i++) { result[i] = new Vector3(floats[i * 3], floats[i * 3 + 1], floats[i * 3 + 2]); } return(result); }