Get Position of specific mesh instance

Hi forum,
I’ve got a model with several mesh instances. Is it possible to get the position of a specific mesh instance (model is animated) so that I can bind an asset to that position?

Hi @Karl47,

You can get that position by referencing the pc.GraphNode used by each mesh instance:

var meshInstanceWorldPos = this.entity.model.meshInstances[2].node.getPosition();
1 Like

Hi @Leonidas, thanks for the quick reply. The problem is, that is tells me that the length of meshInstances = 1 but as you can see (screenshot) there are more than one in the model. Maybe I did something wrong during exporting fbx from C4D?

Hmm, that’s strange, if the asset has 12 mesh instances you could definitely target them in code. Are you sure you are targeting the right entity/model?

If you still experience this issue try sharing a small sample project to take a look.

1 Like

Oh my god… :flushed: So sorry… :grinning: Thanks!

1 Like

You can also this.entity.findByName with the name of the node incase the order of the meshinstances change or the model is updated.

2 Likes

So cool and so easy! Thanks a lot!