xeolabs/scenejs — Issue #166: Question regarding highlight on Pick (inserting and removing materials)
Author: LloydPickering
Created: 2012-02-16 16:25:55+00:00
State: open

I'm just wondering what is the best way to 'highlight' a picked item in the scene?

Right now the scene is composed of a library of materials such as wall, roof etc and the geometry is all wrapped in name nodes.

I assumed that setting up a new pick-material in the library was the way forward so that when I pick an item, I can insert a new instance of the pick-material above the name node - so far so good, works fine.

But...when I then come to unpick the name node I need to remove the pick-material instance while keeping the children intact, which is where I am having problems.

If I remove the pick-material, all children are deleted. If I attempt to add the child nodes to the parent before pick-material is removed, I cannot as they already have a parent.

As far as I can tell, there is a method in the node to splice, which sounds like what I am looking for, except it can only be accessed through the _targetNode and doesn't seem to work.

Please can someone suggest an improved, working way for me to do this?