WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 10-23-2008, 03:35 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You can use viz.pick() to find what object the mouse is pointing at. Here's some code that uses viz.pick and checks to see if the mouse is pointing at the avatar's head mesh, body mesh, or some other object. Depending on what is picked the avatar will change animations.

Code:
import viz

viz.go()

viz.add('court.ive')
avatar = viz.add('vcc_male.cfg', pos = [0,0,5], euler = [180,0,0])
avatar.state(1)


def onMouseDown(button):
	
	#if you pass in a value 1 a VizIntersect object will be returned
	object = viz.pick(1)
	
	if object.valid and object.name == 'casual32_m_highpoly.CMFX':
		print "you picked the avatar's head"
		avatar.state(2)
	elif object.valid and object.name == 'casual32_m_highpoly01.CMFX':
		avatar.state(4)
		print "you picked the avatar's body"
	else:
		avatar.state(1)
		print "you picked " + object.name
	
		

viz.callback(viz.MOUSEDOWN_EVENT,onMouseDown)
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
Best way to synchronize avatar actions mjabon Vizard 1 07-29-2008 11:15 AM
Collision of an avatar with a quad Frank Verberne Vizard 8 06-04-2008 09:44 AM
Looking through the eyes of an avatar Frank Verberne Vizard 2 04-01-2008 05:52 AM
How to make avatar's eyes to blink when speaking michelcm3 Vizard 12 01-15-2008 08:48 AM
Avatars in an array and link/unlink betancourtb82 Vizard 7 09-05-2006 04:06 PM


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


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