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

  • Home
  • SEARCH
  • 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 8907673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:58:38+00:00 2026-06-15T02:58:38+00:00

I am doing a very simple stuff, my goal is to move one skeleton

  • 0

I am doing a very simple stuff, my goal is to move one skeleton based on the position of the other skeleton, for this i am based myself on a HipCenter position.
(This algoritm could be wrong, this question is about a exception ocurring in the foreach loop)

Here is my actual code:

public static Skeleton MoveTo(this Skeleton skOrigin, Skeleton skDestiny)
{
     Skeleton skReturn = skOrigin; // just making a copy

        // find the factor to move, based on the HipCenter.
        float whatToMultiplyX = skOrigin.Joints[JointType.HipCenter].Position.X / skDestiny.Joints[JointType.HipCenter].Position.X;
        float whatToMultiplyY = skOrigin.Joints[JointType.HipCenter].Position.Y / skDestiny.Joints[JointType.HipCenter].Position.Y;
        float whatToMultiplyZ = skOrigin.Joints[JointType.HipCenter].Position.Z / skDestiny.Joints[JointType.HipCenter].Position.Z;


        SkeletonPoint movedPosition = new SkeletonPoint();
        Joint movedJoint = new Joint();
        foreach (JointType item in Enum.GetValues(typeof(JointType)))
        {
            // Updating the position
            movedPosition.X = skOrigin.Joints[item].Position.X * whatToMultiplyX;
            movedPosition.Y = skOrigin.Joints[item].Position.Y * whatToMultiplyY;
            movedPosition.Z = skOrigin.Joints[item].Position.Z * whatToMultiplyZ;

            // Setting the updated position to the skeleton that will be returned.
            movedJoint.Position = movedPosition;
            skReturn.Joints[item] = movedJoint;
        }

        return skReturn;
    }

Using F10 to debug everything works fine ultin the second pass in te foreach loop.
When i am passing for the second time in the foreach i get a exception on this line

skReturn.Joints[item] = movedJoint;

The exception says:

JointType index value must match Joint.JointType 

But the value is actualy the Spine.

Whats wrong?

  • 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-15T02:58:39+00:00Added an answer on June 15, 2026 at 2:58 am

    Solved, here is the solution

     Joint newJoint = new Joint(); // declare a new Joint
    
    // Iterate in the 20 Joints
    foreach (JointType item in Enum.GetValues(typeof(JointType)))
    {
        newJoint = skToBeMoved.Joints[item];
    
                // applying the new values to the joint
                SkeletonPoint pos = new SkeletonPoint()
                {
                    X = (float)(newJoint.Position.X + (someNumber)),
                    Y = (float)(newJoint.Position.Y + (someNumber)),
                    Z = (float)(newJoint.Position.Z + (someNumber))
                };
    
                newJoint.Position = pos;
                skToBeChanged.Joints[item] = newJoint;
            }
    

    This will work.

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

Sidebar

Related Questions

I am doing very simple int division and I am getting odd results. This
I'm doing this with a very simple class, just to learn, but I'm not
This is a very simple issue. I must just be doing something stupid: This
I'm doing some very simple Core Data stuff with a storyboard, I am able
hello i m doing a very simple Asp.net application project namespace WebApplication1 { public
I'm having some trouble doing a very simple task. I have a rich textbox
I have the following PHP code doing a very simple select into a table.
I have a very simple CLR Function for doing Regex Matching public static SqlBoolean
I am trying to create very simple image browser with jQuery. I am doing
I am doing a Canvas app inside the facebook page. My very simple question

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.