WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-14-2013, 07:04 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
In the following example the spacebar is used to start and stop the avatar as he walks between two points:
Code:
import viz
import viztask
import vizact
viz.go()

viz.add('ground.osgb')
avatar = viz.addAvatar('vcc_male2.cfg',pos=[0,0,9])
avatar.state(1)

walkLeft = vizact.walkTo([2.5,0,9])
walkRight = vizact.walkTo([-2.5,0,9])
walkActions = viz.cycle([walkLeft,walkRight])

waitSpaceBar = viztask.waitKeyDown(' ')
waitLeft = viztask.waitActionEnd(avatar,walkLeft)
waitRight = viztask.waitActionEnd(avatar,walkRight)
waitActions = viz.cycle([waitLeft,waitRight])

def walkAndStopTask():
	yield waitSpaceBar
	while True:
		condition = waitSpaceBar
		walkAction = walkActions.next()
		waitAction = waitActions.next()
		while condition == waitSpaceBar:
			avatar.runAction(walkAction)
			d = yield viztask.waitAny([waitSpaceBar,waitAction])
			condition = d.condition
			if condition == waitSpaceBar:
				avatar.clearActions()
				yield waitSpaceBar
			
viztask.schedule(walkAndStopTask())

Last edited by Jeff; 03-14-2013 at 08:08 AM.
Reply With Quote
 

Tags
avatar, interrupt, stop, walkto


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
Avatar & Motion Capture Interface Angie Vizard 1 08-05-2010 07:17 PM
avatar scale and link.setpos conflict? sircedric4 Vizard 0 09-29-2009 08:48 AM
Collision of an avatar with a quad Frank Verberne Vizard 8 06-04-2008 10:44 AM
Looking through the eyes of an avatar Frank Verberne Vizard 2 04-01-2008 06:52 AM
How to make avatar's eyes to blink when speaking michelcm3 Vizard 12 01-15-2008 09:48 AM


All times are GMT -7. The time now is 01:21 PM.


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