Jump to content

Recommended Posts

Posted

Code for loading VR pose data from SteamVR (converting it into JSON files)

    table t;
    auto stream = ReadFile(GetPath(PATH_DESKTOP) + "/R_BONE_ROTATIONS.txt");
    t = {};
    while (not stream->Eof())
    {
        String s = stream->ReadLine();
        s = s.Replace("x:", "");
        s = s.Replace("y:", "");
        s = s.Replace("z:", "");
        s = s.Replace("w:", "");
        s = s.Replace("-", "");
        s = s.Replace("{", "");
        s = s.Replace("}", "");
        s = s.Replace(" ", "");
        auto sarr = s.Split(",");
        table r = {};
        for (int n = 0; n < sarr.size(); ++n) r[n] = sarr[n].ToFloat();
        t.push_back(r);
    }
    SaveTable(t, StripExt(stream->path) + ".json");

 

  • Like 1

Let's build cool stuff and have fun. :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...