PDA

View Full Version : get object on mouse click


Batigol
10-19-2012, 03:03 AM
Hi all,

I'm very new with Vizard.
I'm trying to get object on mouse click. But I just get to root object viz.VizChild(1) not the subobject like c1,c2....
The viz.pick(info=True).name just return the name of material not object name.
How could I access to subobject?

http://forum.worldviz.com/attachment.php?attachmentid=539&stc=1&d=1350637144

farshizzo
10-22-2012, 04:21 PM
You can use the node.getChild command to get a handle to a sub-node. Example:
slider = viz.addChild('sodoku.ive')
c2 = slider.getChild('c2')
.
.
.
obj = viz.pick()
if obj == c2:
print 'c2 picked'

Batigol
10-22-2012, 08:30 PM
I already tried it. It worked.
But it is so strange to compare with other game engine
Anyway, thanks for your comments

JvdBosch
10-25-2012, 02:14 AM
You can use the node.getChild command to get a handle to a sub-node. Example:
slider = viz.addChild('sodoku.ive')
c2 = slider.getChild('c2')
.
.
.
obj = viz.pick()
if obj == c2:
print 'c2 picked'


This works fine, but introduces extra drawables in the scene. With large scenes this can hurt the framerate. Is there no other way to do this? Maybe it can be on the wish-list for the next update? ;)

farshizzo
10-25-2012, 10:36 AM
Calling getChild should not introduce more drawables. Can you post an example where it does?

This is already a feature in the upcoming Vizard 5 release. You will be able to get access to the full node hierarchy of the intersection.

Batigol
10-25-2012, 09:03 PM
Calling getChild should not introduce more drawables. Can you post an example where it does?

This is already a feature in the upcoming Vizard 5 release. You will be able to get access to the full node hierarchy of the intersection.

It's sound great :)