Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8991003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:37:34+00:00 2026-06-15T22:37:34+00:00

So I am putting some data into a dictionary. A String (name) and a

  • 0

So I am putting some data into a dictionary. A String (name) and a Bone (used to hold position and stuff). I am reading from the kinect what the position of the bone is, then I am putting it into the dictionary then later on I am saving them to a .txt file. Now I am pretty confused because all of them are the same. For a while I have a few labels showing the different positions of a few bones, and they were all changing. So that means it has to do with my putting into the dictionary?

Here is my input method:

        JointCollection joints = skele.Joints;
        List<Bone> temp = current_bones;
        Frame temp_f = new Frame(temp);
        Joint h_j = joints[JointType.Head];
        foreach (Joint j in joints)
        {
            try
            {
                switch (j.JointType)
                {
                    #region cases
                    case (JointType.Head):
                        temp_f.frame_bones["Head"].setPosition(j.Position.X, j.Position.Y, j.Position.Z);
                        break;
...Other stuff that basically repeats but with different jointtypes
                }
            }
            catch (Exception ex) { /*MessageBox.Show("Error getting joints: " + ex.Message);*/ }
        }
        if (recording)
        {
            if (newR)
            {
                bvhBuilder.resetAnimation();    //Resets a list of frames
                newR = false;
            }
            bvhBuilder.add_frame(temp_f);//adds a frame to the list
        }

Main stuff in Bone class:

public Bone(String b_name)
    {
        name = b_name;
    }

    public void setPosition(float _x, float _y, float _z)
    {
        x = _x; y = _y; z = _z; 
    }

relevent stuff in my BVHBuilder class:

List<Bone> current_bones = new List<Bone>();
    Frame current_frame;
    List<Frame> animation_frames = new List<Frame>();
    public BVHBuilder(List<Bone> bones)
    {
        current_bones = bones;
    }
public String build()
    {
        StringBuilder builder = new StringBuilder();
        builder.AppendLine(build_bones());
        builder.AppendLine(build_anim());
        return builder.ToString();
    }

 public String build_anim()
    {
        StringBuilder sb = new StringBuilder();
        sb.AppendLine("MOTION");
        sb.AppendLine("Frames: " + getFrameCount());
        sb.AppendLine("Frame Time: " + (float)((float)1/(float)30));
        foreach (Frame frame in animation_frames)
        {
            String line = "";
            int b_i = 0;
            float root_x = frame.root.x;
            float root_y = frame.root.y;
            float root_z = frame.root.z;
            Console.WriteLine("Root: (" + root_x + "," + root_y + "," + root_z + ")"); 
            for (int i = 0; i < frame.frame_bones.Count; i++)
            {
                Bone bone = frame.frame_bones.Values.ElementAt(i);
                line += (bone.x - root_x) + " ";
                line += (bone.y - root_y) + " ";
                if (b_i >= frame.frame_bones.Count) { line += (root_z - bone.z); }   //Don't want a space at the end
                else { line += (root_z - bone.z) + " "; }

                b_i++;
            }
            sb.AppendLine(line);
        }
        return sb.ToString();
    }

Frame class:

class Frame
{
    public Dictionary<String, Bone> frame_bones = new Dictionary<String, Bone>();
    public Bone root = null;
    int root_pos = 0;

    public Frame(List<Bone> bones)
    {
        int i = 0;
        foreach (Bone b in bones)
        {
            frame_bones.Add(b.name,b);
            if (b.root) { root_pos = i; root = b; }
            i++;
        }
    }
}

And this is where it saves:

private void saveAnim()
    {
        int times = 0;
        String path = "";
        Boolean exists = true;
        while (exists)
        {
            path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\" + "nectrecord" + times + ".txt";
            exists = File.Exists(path);
            times++;
        }
        currP = path;
        Console.WriteLine(currP);
        StreamWriter sw = new StreamWriter(currP);
        String write = bvhBuilder.build();
        int max_i = write.Length;
        progressBar1.Maximum = max_i;
        int c_i = 0;
        foreach (char c in write)
        {
            sw.Write(c);
            c_i++;
            progressBar1.Value = c_i;
        }
        sw.Flush();//make sure everything wrote
        sw.Close();
        MessageBox.Show("Saved to :" + currP);
    }

I know that is a lot of code, but I have been trying to debug this for probably 4 hours now. Hopefully a fresh pair of eyes will help me find the problem.

Btw this is what the output file looks like:

HIERARCHY
ROOT Hip_C
{
OFFSET 0 0 0
CHANNELS 3 Xposition Yposition Zposition
JOINT Spine
{
    OFFSET 0 0 0
    CHANNELS 3 Xposition Yposition Zposition
    JOINT Shoulder_C
    {
        OFFSET 0 0 0
        CHANNELS 3 Xposition Yposition Zposition
        JOINT Head
        {
            OFFSET 0 0 0
            CHANNELS 3 Xposition Yposition Zposition
        }
        JOINT Shoulder_R
        {
            OFFSET 0 0 0
            CHANNELS 3 Xposition Yposition Zposition
            JOINT Elbow_R
            {
                OFFSET 0 0 0
                CHANNELS 3 Xposition Yposition Zposition
                JOINT Wrist_R
                {
                    OFFSET 0 0 0
                    CHANNELS 3 Xposition Yposition Zposition
                    JOINT Hand_R
                    {
                        OFFSET 0 0 0
                        CHANNELS 3 Xposition Yposition Zposition
                    }
                }
            }
        }
        JOINT Shoulder_L
        {
            OFFSET 0 0 0
            CHANNELS 3 Xposition Yposition Zposition
            JOINT Elbow_L
            {
                OFFSET 0 0 0
                CHANNELS 3 Xposition Yposition Zposition
                JOINT Wrist_L
                {
                    OFFSET 0 0 0
                    CHANNELS 3 Xposition Yposition Zposition
                    JOINT Hand_L
                    {
                        OFFSET 0 0 0
                        CHANNELS 3 Xposition Yposition Zposition
                    }
                }
            }
        }
    }
}
JOINT Hip_R
{
    OFFSET 0 0 0
    CHANNELS 3 Xposition Yposition Zposition
    JOINT Knee_R
    {
        OFFSET 0 0 0
        CHANNELS 3 Xposition Yposition Zposition
        JOINT Ankle_R
        {
            OFFSET 0 0 0
            CHANNELS 3 Xposition Yposition Zposition
            JOINT Foot_R
            {
                OFFSET 0 0 0
                CHANNELS 3 Xposition Yposition Zposition
            }
        }
    }
}
JOINT Hip_L
{
    OFFSET 0 0 0
    CHANNELS 3 Xposition Yposition Zposition
    JOINT Knee_L
    {
        OFFSET 0 0 0
        CHANNELS 3 Xposition Yposition Zposition
        JOINT Ankle_L
        {
            OFFSET 0 0 0
            CHANNELS 3 Xposition Yposition Zposition
            JOINT Foot_L
            {
                OFFSET 0 0 0
                CHANNELS 3 Xposition Yposition Zposition
            }
        }
    }
}
}



MOTION
Frames: 210
 Frame Time: 0.03333334
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05713073 -0.009174455 -0.2937571 0.2087359 -0.2028138 -0.902887 0.2087359 -0.2028138 -0.9028869 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05713073 -0.009174455 -0.2937571 0.2087359 -0.2028138 -0.902887 0.2087359 -0.2028138 -0.9028869 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05713073 -0.009174455 -0.2937571 0.2087359 -0.2028138 -0.902887 0.2087359 -0.2028138 -0.9028869 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05713073 -0.009174455 -0.2937571 0.2087359 -0.2028138 -0.902887 0.2087359 -0.2028138 -0.9028869 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05713073 -0.009174455 -0.2937571 0.2087359 -0.2028138 -0.902887 0.2087359 -0.2028138 -0.9028869 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05713073 -0.009174455 -0.2937571 0.2087359 -0.2028138 -0.902887 0.2087359 -0.2028138 -0.9028869 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05713073 -0.009174455 -0.2937571 0.2087359 -0.2028138 -0.902887 0.2087359 -0.2028138 -0.9028869 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05713073 -0.009174455 -0.2937571 0.2087359 -0.2028138 -0.902887 0.2087359 -0.2028138 -0.9028869 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05713073 -0.009174455 -0.2937571 0.2087359 -0.2028138 -0.902887 0.2087359 -0.2028138 -0.9028869 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

…and that continues for a while

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T22:37:35+00:00Added an answer on June 15, 2026 at 10:37 pm

    Well, it had to do with some problem with the frame class maybe? Cause I mad a List and put the data directly into it and it works fine now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am putting some heavy though into re-writing the data access layer in my
We're planning on putting a lot of metric data into some sort of nosql
I have built in some Core Data support into my app from the Core
I have been putting some data I have into my database. One of the
I'm looking to transfer some data from a multi-million row table into another table.
I'm parsing some data by using PHP and putting it into MySQL. But if
I was just putting some thought into different languages (as I'm reviewing for final
I'm trying to simplify some code by putting the ViewModel models into the code
I have an odd one - I am porting some data from one CMS
On my activity, im getting some big data from web, and while getting this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.