Skip to content

Instantly share code, notes, and snippets.

@ericflo
Created June 1, 2016 19:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericflo/716daaa9b0fceec608633fd012246ddf to your computer and use it in GitHub Desktop.
Save ericflo/716daaa9b0fceec608633fd012246ddf to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.IO;
using System.Collections.Generic;
public class Frame
{
public static int VERSION = 1;
public double Timestamp;
public float UserPosX;
public float UserPosY;
public float UserPosZ;
public float UserRotX;
public float UserRotY;
public float UserRotZ;
public float HeadPosX;
public float HeadPosY;
public float HeadPosZ;
public float HeadRotX;
public float HeadRotY;
public float HeadRotZ;
public float EyePosX;
public float EyePosY;
public float EyePosZ;
public float EyeRotX;
public float EyeRotY;
public float EyeRotZ;
public float LeftHandPosX;
public float LeftHandPosY;
public float LeftHandPosZ;
public float LeftHandRotX;
public float LeftHandRotY;
public float LeftHandRotZ;
public float RightHandPosX;
public float RightHandPosY;
public float RightHandPosZ;
public float RightHandRotX;
public float RightHandRotY;
public float RightHandRotZ;
public int AudioSampleCount;
public float[] AudioSamples;
public Frame(double timestamp, Transform user, Transform head, Transform eye, Transform leftHand, Transform rightHand, float[] audioSamples)
{
Timestamp = timestamp;
UserPosX = user.localPosition.x;
UserPosY = user.localPosition.y;
UserPosZ = user.localPosition.z;
UserRotX = user.localRotation.eulerAngles.x;
UserRotY = user.localRotation.eulerAngles.y;
UserRotZ = user.localRotation.eulerAngles.z;
HeadPosX = head.localPosition.x;
HeadPosY = head.localPosition.y;
HeadPosZ = head.localPosition.z;
HeadRotX = head.localRotation.eulerAngles.x;
HeadRotY = head.localRotation.eulerAngles.y;
HeadRotZ = head.localRotation.eulerAngles.z;
EyePosX = eye.localPosition.x;
EyePosY = eye.localPosition.y;
EyePosZ = eye.localPosition.z;
EyeRotX = eye.localRotation.eulerAngles.x;
EyeRotY = eye.localRotation.eulerAngles.y;
EyeRotZ = eye.localRotation.eulerAngles.z;
LeftHandPosX = leftHand.localPosition.x;
LeftHandPosY = leftHand.localPosition.y;
LeftHandPosZ = leftHand.localPosition.z;
LeftHandRotX = leftHand.localRotation.eulerAngles.x;
LeftHandRotY = leftHand.localRotation.eulerAngles.y;
LeftHandRotZ = leftHand.localRotation.eulerAngles.z;
RightHandPosX = rightHand.localPosition.x;
RightHandPosY = rightHand.localPosition.y;
RightHandPosZ = rightHand.localPosition.z;
RightHandRotX = rightHand.localRotation.eulerAngles.x;
RightHandRotY = rightHand.localRotation.eulerAngles.y;
RightHandRotZ = rightHand.localRotation.eulerAngles.z;
AudioSampleCount = audioSamples.Length;
AudioSamples = audioSamples;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment