Accessing instance of a cloned objects group

Quick question here. I’m sure it’s ez but I spent too much time trying so I’d rather ask.
How do I access an instance that is a child of a cloned object group/parent.

The parent is cloned with all instances and the clone gets a new name but all the children (instances) still have the same name.

Question is: How do I access these instances part of my cloned object group?

Thanks in advance,

You already have all meshes names you need :slight_smile:
scene.getMeshByName('sink_console0').position.x = 10

Yes, but I want to change only the instance that is part of the ‘cloned’ object group. Not the one from the base group.

Edit: I mean I can access it like this, but there must be a better way (the correct way):

You created all names already, so the index of your parent will be the index of child instance.
You may add an array to store all indexes for direct use or map them to key-value pair for fast access.

1 Like

Really? I mean I have this alternate way which also works…

but isn’t there anything really slick and ez to access it? Makes me wonder.
Thanks anyways. At least I have a way I can use. Still interested in knowing why this is (or if it can be improved).
Meanwhile, have a great day :sunglasses:

Edit: Ok, so I’m gonna keep with my second solution for now. It will do because I only have a limited number and It’s named so I can just run a for loop on init. Since I need it only on init, it doesn’t really matter. But then, if I had to access a large number of those at different time, I would need to go with your solution using an index I suppose. Thanks again,

So, my final code will look like this (for now):

Edit1: And just in case you were wondering about the use case, this is what this was all about (WIP)

Here is the simple example of quick access as consoleArray.get(2) -


Oh, thanks a lot :hugs:. That’s nice. I’m gonna keep this bookmarked for later use.

1 Like