WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 08-19-2009, 12:38 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
The link you provided is for finding intersections with physics shapes, from your question though it sounds like you just want to see which sub-object was picked.

You can use viz.pick() to do that. This code uses the gallery model and prints out the name of the child object that is clicked on. If you right cick on gallery.ive in Vizard's resource window you can look through the hierarchy and see the matching names.

The name returned is for lowest object in the scene graph that was picked. If this sub-object does not have a name then the first named object above it will be returned.
Code:
import viz
viz.go()

#use keyboard navigation, mouse for picking
import vizcam
viz.cam.setHandler(vizcam.KeyboardCamera())

viz.add('gallery.ive')

def showPicked():
	
	#use viz.pick with mode = 1.  This will return a Vizintersect
	#object which we can use to retrieve the object' name
	object = viz.pick(1)
	if object.valid:
		print 'object name:  ', object.name
		
vizact.onmousedown(viz.MOUSEBUTTON_LEFT, showPicked)
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Internal nodes of loaded model files? dtidrow Vizard 2 05-12-2009 08:55 AM
Creating occluder nodes in .ive file dtidrow Vizard 1 12-09-2008 10:40 AM
Collision with child nodes rubberpimple Vizard 4 09-17-2008 04:27 PM
Pickling Nodes Vygreif Vizard 3 02-23-2006 10:03 AM


All times are GMT -7. The time now is 12:45 AM.


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