Render Picking invisible objects / consolidating objects inside of a geo

I have a project where I’m trying to trigger a box to open when picked via multitouch dat. It appears that when I try to pick from a geo that has other geos inside of it, the renderpick will grab and display the nested geos names instead of the parent geo name. Because my box is made up of multiple geos and this is causing problems.

I have attached my project. It has a box and a torus. If you click on the torus it turns black. If you click on the box the torus also turns black because the lid nested inside of the parent box geo is also called “geo2”

Ideally I would be able to pick from an invisible rectangle that hovers over my box, but i cant seem to get that to work either. Does anyone have any ideas?

RenderPicker_Torus_Box.tox (20.4 KB)

Hi @nhodeisland,

the renderpicking depends on SOP operators as it samples the render and returns 3d information on the picked geometry. Hence it can’t pick a Geo COMP but will always return the SOP that is being rendered. So a Geo Component with no rendered SOP but only a hierarchy of other Geo COMPs will not directly show up in the renderpick results.
One thing to overcome this is Parent Shortcuts
Say you give your root Geo COMPs geo1 and geo2 the parent shortcut ‘PickRoot’ you can get easily to the root object by saying: geo = e.pickOp.parent.PickRoot. Your callback function slightly adjusted then looks like this:

def onEvents(renderPickDat, events, eventsPrev):

	for e in events:
		if e.pickOp == None :
			continue
		#insert code for event, eventsPrev here

		geo = e.pickOp.parent.PickRoot
				
		if e.selectStart == 1 :
			geo.par.Open = 0
		
		if e.selectEnd == 1 :
			geo.par.Open = 1
		
		pass

	return

The way Parent Shortcuts work, it doesn’t matter how deeply nested your geometry is - parent.PickRoot will always return the first operator with this shortcut up the chain.

Hope this helps
Cheers
Markus

1 Like

Ah thank you so much!