Author Topic: Rotating joints  (Read 826 times)

Offline idkm23

  • byte
  • *
  • Posts: 34
    • View Profile
Rotating joints
« on: December 28, 2015, 08:11:02 pm »
I am currently working with ProceduralAnimationSample and I am trying to get our beloved seymour to wave at me. I am having trouble getting his palm to face me. I have the arm waving at me with his palm facing the void adjacent to him with the code below:

Code: [Select]
//elbow oscillatory motion
targetJoint(currentPose, 11, new SimpleVector(-1, 0, 0), new SimpleVector(-1 + Math.cos(seconds) * 5, -20, 0), 1.0f);

When I attempt to use the same method targetJoint for the wrist, I can get his fingers to point at me, but it does not rotate. I think I might need to do something to currentPose, but I am not sure.

Thanks for any insight.
« Last Edit: December 28, 2015, 08:37:08 pm by idkm23 »

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1972
    • View Profile
    • http://www.aptalkarga.com
Re: Rotating joints
« Reply #1 on: December 28, 2015, 09:01:06 pm »
no, the code actually updates the relevant joint in SkeletonPose.

it's just that, the math behind the skeletal animation is a bit weird. to tell the truth I'm not fluent at that too. google and read for it. one thing you must remember is that, every joint's transformation is in its parent joint's space.

this may be a good starting point to read

Offline idkm23

  • byte
  • *
  • Posts: 34
    • View Profile
Re: Rotating joints
« Reply #2 on: December 29, 2015, 12:54:58 am »
Isn't there a simple solution to just rotating a bone on a joint? I feel like the targetJoint function could rotate a bone if I changed the jointBindPose. I will keep looking into this. Thank you for your advice.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1972
    • View Profile
    • http://www.aptalkarga.com
Re: Rotating joints
« Reply #3 on: December 29, 2015, 01:47:43 am »
Isn't there a simple solution to just rotating a bone on a joint?
SkeletonHelper may help.

Offline idkm23

  • byte
  • *
  • Posts: 34
    • View Profile
Re: Rotating joints
« Reply #4 on: December 29, 2015, 09:30:42 pm »
I figured out that all you have to do is grab the matrix of the joint and use the function rotateX (or some other axis) and that seems to do the trick.