I’m struggling to get a dynamic node position from an animated GLB model in the scene. I don’t import the hierarchy (via asset tasks), but do successfully get a position with the below code in update(), but the returned position never changes during animation.
FollowNode.prototype.postUpdate = function(dt) {
this.nodeToFollow = this.entityToFollow.model.meshInstances[2].node;
var p = this.nodeToFollow.getPosition();
console.log(`followNode: position: ${p.x}, ${p.y}, ${p.z} `);
//this line always logs: 'followNode: position: 0.0108591, 0.3478, 0.0354'
}
I think what you are looking for is the position of a skeleton bone. The base node of the mesh instance won’t be moved with the animation, that’s why it remains at the same position.
Try finding the bone node by its name and then try getting its position:
var boneNode = this.entityToFollow.findByName('bone-name');