Author Topic: Positioning and orienting Object3D with a Bones joint?  (Read 539 times)

Offline dcfingerprint

  • byte
  • *
  • Posts: 7
    • View Profile
Positioning and orienting Object3D with a Bones joint?
« on: December 08, 2016, 10:18:51 pm »
Hi,

I'm interested in dynamically adding an Object3D to the world and positioning/orienting it relative to a particular Bones Joint in an Animated3D.   

For example - to place an dynamically created object in the hand of a model, and keeping it aligned with the hand as it moves/rotates.  (Or a hat on the head of a model, which will stay on the head, regardless of how the model animates.) 

Any tips for getting the position and rotation to use with either Object3D.setTranslationMatrix(), setRotationMatrix(), or using Object3D.translate(x,y,z) / rotateX(), rotateY(), rotateZ() / rotateAxis() ? 

The Object3D to "attach" could either be a sibling of the Animated3D root, or a child.

Any code samples would be appreciated.  Thanks!

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: Positioning and orienting Object3D with a Bones joint?
« Reply #1 on: December 09, 2016, 12:12:12 am »
have a look at source code of SkeletonDebugger, it does sth similar to your case, positions "joint" and "bone" objects according to where joint actually is.