[SOLVED] How to get dynamic node position from animated GLB?

Hi folks,

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'

Any help would be really appreciated…
Thank you.

Hi @Isaac,

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');
1 Like

Hi @Leonidas , thanks for the super speedy reply!
I’ve just tried the below, but unfortunately see the same position in the console:

    this.nodeToFollow  = this.entityToFollow.findByName(this.nodeName);
    var p = this.nodeToFollow.getPosition();
    console.log(`followNode: position: ${p.x}, ${p.y}, ${p.z} `);

Perhaps I should create a demo project for you to see?


Yes, try sharing a demo with your issue.

Here is me trying the same code on the Animation Blending tutorial project:

1 Like

Thanks @Leonidas,
I’ve just setup a project here which hopefully crystallises my issue…

Looking forward to any pearls of wisdom :slight_smile:

It’s possible that it’s the jnt that is animating:

Try using ‘PRP_Bee01:BeeHead_C0_0_jnt’


This looks like the solution!!

I had assumed every node had a transform which would be updated with relative positional data(?)

Thanks for your help good sir, really appreciate it and also for all your other posts over the years.

Isaac :slight_smile:

1 Like