WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-26-2018, 06:51 AM
tianmoran tianmoran is offline
Member
 
Join Date: Nov 2016
Posts: 16
Unhappy Avatar animation -- change states

Hi,

I want to change my avatar's states according to conditions. However, there are some problems with the codes:
Code:
def ani_change():
	female1 = viz.add('Avatars/Avatars/CC2_f001_hipoly_A1_v2.cfg')
	female1.setPosition(1,0.5,1)	
	female1.setEuler(90,8,0)
	bloNo = 10
	Code = [0,1,0,1,0,1,0,1,0,1]
	for block in range(bloNo):
		female1.visible(viz.ON)
		if Code[block] == 0:
			female1.execute(8,0,0,freeze =  True)
			female1.setAnimationSpeed(8,0)	
		elif Code[block] == 1:
			female1.execute(3,0,0, freeze = False)
			yield viztask.waitTime(3)
			for j in range(10):
				female1.blend(3,1-float(j/10))
				female1.blend(8,float(j/10))
				yield viztask.waitTime(float(j/2))
			yield viztask.waitTime(0.5)
			female1.state(8)
		female1.visible(viz.OFF)
		yield viztask.waitTime(5)

viztask.schedule(ani_change())
Here are the problems:
1) The avatar's states don't change;

2) The amplitude of the avatar's movement decrease across different trials. Eg. The highest point that her arm could reach is always lower than in the previous trial.

Many thanks!
Reply With Quote
  #2  
Old 04-30-2018, 12:05 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Quote:
1) The avatar's states don't change;
I tested this code with the vcc_female avatar included with Vizard and it alternates between two animations. Does that work for you?
Reply With Quote
  #3  
Old 05-02-2018, 12:20 PM
tianmoran tianmoran is offline
Member
 
Join Date: Nov 2016
Posts: 16
Quote:
Originally Posted by Jeff View Post
I tested this code with the vcc_female avatar included with Vizard and it alternates between two animations. Does that work for you?
Hi,

Thank you for your reply! I tested the codes below:

Code:
def ani_change():
	female1 = viz.add('vcc_female.cfg')
	female1.setPosition(1,0,10)	
	female1.setEuler(90,8,0)
	bloNo = 10
	Code = [0,1,0,1,0,1,0,1,0,1]
	for block in range(bloNo):
		female1.visible(viz.ON)
		if Code[block] == 0:
			female1.execute(2,0,0,freeze =  True)
			female1.setAnimationSpeed(2,0)	
		elif Code[block] == 1:
			female1.execute(11,0,0, freeze = False)
			yield viztask.waitTime(3)
			for j in range(10):
				female1.blend(11,1-float(j/10))
				female1.blend(2,float(j/10))
				yield viztask.waitTime(float(j/2))
			yield viztask.waitTime(0.5)
			female1.state(2)
		female1.visible(viz.OFF)
		yield viztask.waitTime(5)

viztask.schedule(ani_change())
So what I expect in this case is that the female avatar stops then run for a while then stop again, which means she should switch between running and stop for five times. However, in this case she just runs then stops.

So how can I amend the codes to achieve my goal?
Reply With Quote
  #4  
Old 05-02-2018, 03:56 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
The example code below alternates between running and idle animations:

Code:
import viz
import viztask

viz.go()
viz.addChild('piazza.osgb')
female = viz.add('vcc_female.cfg',pos=[0,0,5],euler=[90,0,0])

def ani_change():
	
	for i in range(5):
		female.state(11)
		yield viztask.waitTime(3)
		female.state(1)
		yield viztask.waitTime(1)

viztask.schedule(ani_change())
Reply With Quote
  #5  
Old 05-03-2018, 11:57 AM
tianmoran tianmoran is offline
Member
 
Join Date: Nov 2016
Posts: 16
Hi Jeff,

My initial goal in the first paragraph of codes is to let the avatar sit idle then frozen like a statue for a while. Then repeat this circle. Which is required by the experiment.

So is there a good way to solve this?

BTW, what could be the reason for the second problem?
Reply With Quote
Reply

Tags
aavatar, animation

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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
Walking Animation of Avatar pradeep Vizard 1 07-03-2014 03:35 AM
Clarification on CAL3D Avatar Animation in Vizard shivanangel Vizard 2 11-22-2010 07:16 AM
Collision and avatar animation shahramy Vizard 2 10-26-2010 11:47 PM
changing between avatar states dan12345 Vizard 1 06-23-2008 01:39 PM
avatar animation problems jrodman Vizard 1 01-18-2006 09:12 AM


All times are GMT -7. The time now is 01:04 AM.


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