WorldViz User Forum Avatar animation -- change states
 User Name Remember Me? Password
 Register FAQ Search Today's Posts Mark Forums Read

#1
04-26-2018, 07:51 AM
 tianmoran Member Join Date: Nov 2016 Posts: 14
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.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)
for j in range(10):
female1.blend(3,1-float(j/10))
female1.blend(8,float(j/10))
female1.state(8)
female1.visible(viz.OFF)

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!
#2
04-30-2018, 01:05 PM
 Jeff WorldViz Team Member Join Date: Aug 2008 Posts: 2,437
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?
#3
05-02-2018, 01:20 PM
 tianmoran Member Join Date: Nov 2016 Posts: 14
Quote:
 Originally Posted by Jeff 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.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)
for j in range(10):
female1.blend(11,1-float(j/10))
female1.blend(2,float(j/10))
female1.state(2)
female1.visible(viz.OFF)

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?
#4
05-02-2018, 04:56 PM
 Jeff WorldViz Team Member Join Date: Aug 2008 Posts: 2,437
The example code below alternates between running and idle animations:

Code:
import viz

viz.go()

def ani_change():

for i in range(5):
female.state(11)
female.state(1)

#5
05-03-2018, 12:57 PM
 tianmoran Member Join Date: Nov 2016 Posts: 14
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?

 Tags aavatar, animation

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements Vizard Precision Position Tracker (PPT) Plug-in development

 Similar Threads Thread Thread Starter Forum Replies Last Post pradeep Vizard 1 07-03-2014 04:35 AM shivanangel Vizard 2 11-22-2010 08:16 AM shahramy Vizard 2 10-27-2010 12:47 AM dan12345 Vizard 1 06-23-2008 02:39 PM jrodman Vizard 1 01-18-2006 10:12 AM

All times are GMT -7. The time now is 05:30 AM.

 Contact Us - WorldViz Home - Archive - Top