WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rating: Thread Rating: 19 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 09-14-2004, 09:36 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

Currently, the only way to do this is to use the avatar.speed command. When you set the speed of an avatar to 0, it will effectively freeze it.

I wrote a very short script that shows how to do this. Press the spacebar to activate the animation of the avatar being shot. Once the animation is activated, a timer will be set to expire when the animation is over. The timer will then freeze the avatar.
Code:
import viz
viz.go()

FREEZE_AVATAR = 0

male = viz.add('male.cfg')
male.rotate(180,0,0)
viz.move(0,0,-8)

def onkeydown(key):
	if key == ' ':
		#Perform the action
		male.act(7)
		#Start a timer to freeze the avatar when the action is over
		viz.starttimer(FREEZE_AVATAR,male.getduration(7))
		
viz.callback(viz.KEYDOWN_EVENT,onkeydown)


def ontimer(num):
	if num == FREEZE_AVATAR:
		#Freeze the avatar
		male.speed(0)

viz.callback(viz.TIMER_EVENT,ontimer)
Let me know if you need any more help
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


All times are GMT -7. The time now is 08:31 AM.


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