Positioning and orienting Object3D with a Bones joint?

Started by dcfingerprint, December 08, 2016, 10:18:51 PM

Previous topic - Next topic

dcfingerprint

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!

raft

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.