WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   get object on mouse click (https://forum.worldviz.com/showthread.php?t=4391)

Batigol 10-19-2012 02:03 AM

get object on mouse click
 
1 Attachment(s)
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...1&d=1350637144

farshizzo 10-22-2012 03:21 PM

You can use the node.getChild command to get a handle to a sub-node. Example:
Code:

slider = viz.addChild('sodoku.ive')
c2 = slider.getChild('c2')
.
.
.
obj = viz.pick()
if obj == c2:
    print 'c2 picked'


Batigol 10-22-2012 07: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 01:14 AM

Quote:

Originally Posted by farshizzo (Post 14305)
You can use the node.getChild command to get a handle to a sub-node. Example:
Code:

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 09: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 08:03 PM

Quote:

Originally Posted by farshizzo (Post 14327)
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 :)


All times are GMT -7. The time now is 10:12 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC