• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 217
  • Last Modified:

Translation in object space

I have a mesh, divided into subsets, where each subset contains a part of a human body.
Now I want this human to move. For example put the arm in the air.
The rotation axis will be the axis of the entire model and not go through the point around which
the the arm must rotate.

So I wanted to translate the model in object space, so the point around which the arm turns would
be in the origin of the object space.

Is there a way to do this?

  • 4
  • 4
1 Solution
egsocAuthor Commented:
What I generaly mean is:
Can I rotate the arm around the shoulder without affecting the other subsets?
Well, I thought subsets were usually used to organize geometry by material.  Atleast thats how I use them.

Do your subsets have its own transformation matrix?  If not, you should rethink your subsets and create a hierarchy for rendering your character.  Look in the SDK under "Matrix Stack."

You can generate all of your animation outside of your application.  Load them up in your buffer and swap them every frame to simulate realtime movement.
egsocAuthor Commented:
For now I just splitted the mesh into different files and use offsets to put them together.
That works, but it gives a lot of files.
With subsets I could approuch the bodyparts seperatly.

A matrix is calculated for each part, but when those are in subsets, I can't get the rotations right.
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

So, it sounds to me like you do have a transformation matrix for each piece of the body.  If you apply each subsets matrix before rendering that should allow you to keep everything together.

It would look like this:

          //RENDER LOWERARM.

//so, if you updated the matrix for the upperarm, the lower arm would still be attached appropriately.

Is that what happens with your test?
egsocAuthor Commented:
There's what causes my problem: the matrix treates the subset as if it was still the entire mesh. For the translations that's not a problem if I use my offsets, but the rotations are wrong. You see, the axis of the rotation is the axis of the mesh which spreads the differents subsets around.
egsocAuthor Commented:
My main question here would be:
is each bodypart a separate object (mesh/vertexbuffer) or can this be done with subsets?
Sorry, I didn't realize no one commented on this...

subsets are used for organizing things by material.  That wouldn't give you the freedom of moving an arm with a matrix.  You need to use a new mesh for each body part.  A few of the DirectX books by Andre LaMothe explain this kind of animation.

Your other option is to output all of your animations from a 3d editor and just swap them.  In which case it would be one mesh.

Happy Programming!
PAQed, with points refunded (125)

Community Support Moderator
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now