Author Topic: How to Get Worldspace position of a Joint  (Read 3052 times)

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: How to Get Worldspace position of a Joint
« Reply #15 on: June 10, 2013, 11:28:41 pm »
No, jPCT holds a reference to the matrix. So that means that getGlobal(...) won't work for moving objects. But as this way is both very useful and very efficient, is there any chance I can persuade you to write a getGlobalWS(...)?
« Last Edit: June 11, 2013, 06:04:59 pm by AGP »

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: How to Get Worldspace position of a Joint
« Reply #16 on: June 10, 2013, 11:35:00 pm »
why not just use that code? I've tested it and it works as expected.

Code: [Select]
SimpleVector location = skeletonPose.getGlobal(jointIndex).getTranslation();
location.matMul(animated3D.getWorldTransformation());

I wont and cant write such a method because a SkeletonPose knows nothing about the Animated3D and AnimatedGroup it's attached to. Furthermore, same SkeletonPose can be attached to multiple AnimatedGroup/Animated3D's.

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: How to Get Worldspace position of a Joint
« Reply #17 on: June 10, 2013, 11:37:02 pm »
I see. Thanks.

Offline Gatobot

  • byte
  • *
  • Posts: 15
    • View Profile
Re: How to Get Worldspace position of a Joint
« Reply #18 on: June 11, 2013, 05:46:26 am »
hey raft thanks a lot this works great!! ;D

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: How to Get Worldspace position of a Joint
« Reply #19 on: June 11, 2013, 06:08:17 pm »
It's just that raft's way you have to adjust the objects every iteration, and you end up with multiple matrices that effectively do the same thing. If getGlobalWS(...) were possible, it would be faster, neater, and used less RAM.